Explanation of what is what in /LuaRules ?

Explanation of what is what in /LuaRules ?

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
SeanHeron
Engines Of War Developer
Posts: 614
Joined: 09 Jun 2005, 23:39

Explanation of what is what in /LuaRules ?

Post 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
SirMaverick
Posts: 834
Joined: 19 May 2009, 21:10

Re: Explanation of what is what in /LuaRules ?

Post 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.
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: Explanation of what is what in /LuaRules ?

Post 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.
Post Reply

Return to “Lua Scripts”