[SOLVED]Wiki pages about callins

[SOLVED]Wiki pages about callins

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

Moderator: Moderators

Post Reply
malric
Posts: 521
Joined: 30 Dec 2005, 22:22

[SOLVED]Wiki pages about callins

Post by malric »

In page: http://springrts.com/wiki/Lua_Scripting there is a link to http://springrts.com/wiki/Lua:Callins. There, you can find for example: "addon.UnitEnteredLos(unitID, unitTeam, allyTeam, unitDefID)"

On page http://springrts.com/wiki/LuaCallinReturn there is "UnitEnteredLos() --> "unitID, teamID" "

By looking at the source I found:

Code: Select all

cont/base/springcontent/LuaGadgets/gadgets.lua:function gadgetHandler:UnitEnteredLos(unitID, unitTeam, allyTeam, unitDefID)
and

Code: Select all

cont/LuaUI/widgets.lua:function widgetHandler:UnitEnteredLos(unitID, unitTeam)
Now, the questions:
- is Lua:Callins wiki page about gadgets only?
- is the list on LuaCallinReturn page about widgets only?
- are the above pages generated automatically or based on a specific version? (if it would be a specific version, it would be nice to be mentioned)
- is there a reason why for similar calls gadgets and widgets have different set of parameters? (for the above example does not seem to be anything that should be hidden). Is it performance?
Last edited by malric on 19 May 2014, 11:45, edited 1 time in total.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Re: Wiki pages about callins

Post by FLOZi »

Lua:Callins is mainly based on gadgets, but it is future looking to unified widget/gadget aka addon handler, which may be some way off.

LuaCallinReturn is a horrible mess, it isn't widget specific.

Neither are auto-generated.

Those functions which may differ between (synced) gadget land and widgets are those in the http://springrts.com/wiki/Lua:Callins#S ... ced_Shared section. Basically the reason is that all information should be available to synced (game logic controlling) gadgets, but restricted to unsynced gadget/widget (e.g. information about a enemy unit only detected via radar and not yet in LOS). In such cases I documented the full (synced) param list.
malric
Posts: 521
Joined: 30 Dec 2005, 22:22

Re: Wiki pages about callins

Post by malric »

Thanks for the answers. Maybe you could put a warning on Lua:Callins page so that people don't get the wrong idea (would do it myself, but you are the page creator and you edited the most).

Regarding the callin that got me into this problem: is unitdefid considered not available information for UnitEnteredLos? I understand UnitEnteredRadar not to have the unitdefid, but I am interested in UnitEnteredLos. Is there any way to get the unitdefid for an enemy unit in los?
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Re: Wiki pages about callins

Post by FLOZi »

I will do.

You get the unitID, so just use Spring.GetUnitDefID(unitID) ? Not sure why it isn't passed... old handlers have many inconsistencies.
malric
Posts: 521
Joined: 30 Dec 2005, 22:22

Re: Wiki pages about callins

Post by malric »

Thanks that is what I needed. I now found the reference page containing it (http://springrts.com/wiki/Lua_SyncedRead), seems it will be usefull in the future.
Post Reply

Return to “Lua Scripts”