Teach me how to learn the Lua interface
Posted: 24 Jan 2016, 16:47
From this thread: viewtopic.php?f=15&t=34296 came the idea of creating a Lua "Widget" to watch a replay and extract game-state data while the simulation is replaying the match.
I moved on to learn Lua and troll thoroughly around the Wiki and did my first experiments. Ex. the one found in: https://springrts.com/wiki/Lua:Tutorial_GettingStarted
Then I moved to something serious and from the Callins list: https://springrts.com/wiki/Lua:Callins I found:
Which I promptly experimented with by:
Only to find out the code (commented) would blow up, complaining it was trying to concatenate something that was a table (parameter cmdParams, if I'm not mistaken). And suddenly I realized, I have no idea what type of objects (nor really their meanings) those parameters are so I need to start with that.
I could ask what the parameters are, and that would be helpful, but that would only help me solve this issue. What about when I run into not knowing the params of the next function and the next and the next? I don't want to spend all my time nagging people here in the forums nor have to wait.
So, my question is, how can I find out more info about the Lua interface - how can I learn what types of Lua objects the engine is providing/expecting from my Lua script?
Note: I am a professional Software developer and have basic but decentish knowledge of C++. I can troll through some of the engine's source code, if it doesn't require to correlate a maze of functions in files here and there.
I moved on to learn Lua and troll thoroughly around the Wiki and did my first experiments. Ex. the one found in: https://springrts.com/wiki/Lua:Tutorial_GettingStarted
Then I moved to something serious and from the Callins list: https://springrts.com/wiki/Lua:Callins I found:
Code: Select all
*.DefaultCommand (type, id)
*.CommandNotify (cmdID, cmdParams, cmdOptions)
Code: Select all
function widget:CommandNotify (cmdID, cmdParams, cmdOptions)
--Spring.Echo ("CommandNotify(): " .. cmdID .. " | " .. cmdParams .. " | " .. cmdOptions)
Spring.Echo ("CommandNotify(): " .. cmdID)
return false
end
I could ask what the parameters are, and that would be helpful, but that would only help me solve this issue. What about when I run into not knowing the params of the next function and the next and the next? I don't want to spend all my time nagging people here in the forums nor have to wait.
So, my question is, how can I find out more info about the Lua interface - how can I learn what types of Lua objects the engine is providing/expecting from my Lua script?
Note: I am a professional Software developer and have basic but decentish knowledge of C++. I can troll through some of the engine's source code, if it doesn't require to correlate a maze of functions in files here and there.