Page 1 of 1

Explanation of what is what in /LuaRules ?

Posted: 22 Aug 2009, 11:53
by SeanHeron
Hey, I've stumbled into this problem more than once now, and the best I can find for explanation is here.

I'm not exactly a wiz at Lua, but I might still want to make use of some Gadgets that are out there (eg unit_morph.lua)- however it's not clear to me which *.lua files I'll be needing in my LuaRules folder.

You need to have a main.lua, that much is obvious (and stated in this thread).
But what about the others ? jK states (in the thread linked above - talking about LuaGaia, but I suspect the same applies for LuaRules) that:
jK wrote:you have to setup the gadgetHandler enviroment:
* copy main.lua,draw.lua,gadgets.lua etc. (or link the basecontent ones)
This (pasting a set of files in from a different game) is what worked for the problem described here. I'm less clear, though, on the alternative offered, linking the basecontent ones - I think this means more than just setting up springcontent.sdz as a dependency, right ?

Thanks for any explanations and answers!
Sean

Re: Explanation of what is what in /LuaRules ?

Posted: 22 Aug 2009, 14:14
by SirMaverick
SeanHeron wrote:You need to have a main.lua, that much is obvious (and stated in this thread).
But what about the others ?
Read engine source code for full reference. :-)

In short: for LuaRules the engine looks for a main.lua and draw.lua. Nothing more. But most mods implement a gadget handler in these files that allows to load more files from this point.
Look for includes in the files to see which files are referenced.

Re: Explanation of what is what in /LuaRules ?

Posted: 22 Aug 2009, 16:05
by lurker
If you want to use the gadget handler provided with spring you have main.lua and draw.lua just have a single line in them, that includes the spring version. Many games do this.