Page 1 of 1

Taking a leap towards LUA

Posted: 05 Oct 2007, 16:25
by fusioneko
I'm actually quite int ested in looking at how to learn LUA, however I downloaded the binaries from the LUA site but I don't know how to compile the source D: or well something. I just need a kick here and there, could you guys help me rather then throwing me to goto some other place. I rather ask a community Im sure that knows. :P

Posted: 05 Oct 2007, 16:41
by tombom
You don't need the binaries from the Lua site to use Lua in Spring.

Posted: 05 Oct 2007, 16:43
by fusioneko
Ok, Then Lua is not compiled in anyway?

Posted: 05 Oct 2007, 16:56
by BigHead
No, you only need to put your .lua file into LuaUI/Widgets folder.

Posted: 05 Oct 2007, 17:20
by fusioneko
:) Thanks alot this helps, Im afraid in the Begginers FAQ It wasn't covered there you might want to make it more noticeable if its not in there. ^_^

Posted: 05 Oct 2007, 18:13
by AF
Spring compiles it all for you when the mods loaded, just make sure your lua code has no bugs in it and your good to go.

Posted: 05 Oct 2007, 18:49
by fusioneko
:D thanks I think I'll look more in depth into it later when I can. I'll proabbly play arround with it, but I don't know how much I'll actually get done. I have to learn the language :D anyone know a good example to study off?

Posted: 05 Oct 2007, 19:07
by AF
Look at CA for mod gadgets and look at various widgets.

Posted: 05 Oct 2007, 21:29
by Felix the Cat
AF wrote:Spring compiles it all for you when the mods loaded, just make sure your lua code has no bugs in it and your good to go.
Hmm.

What's a good way to test for bugs? Obviously you can't compile and run a Lua file made for Spring as it will have all sorts of unknown identifiers or whatever Lua calls undefined functions and variables.

Posted: 05 Oct 2007, 21:45
by quantum
You can type "/luaui reload" or ".luarules reload" for a quick check in-game. If you just need to check for syntax errors, you shouldn't have problems compiling the script. Here is the windows version of the compiler.

Posted: 06 Oct 2007, 00:48
by LordMatt
quantum wrote:You can type "/luaui reload" or ".luarules reload" for a quick check in-game. If you just need to check for syntax errors, you shouldn't have problems compiling the script. Here is the windows version of the compiler.
Better yet bind luaui reload to a key in uikeys.txt:

Code: Select all

unbind      Any+backspace  mousestate
bind backspace luaui reload