Topic: Lua production/consumption variables.
Tibor |
Posted at: 2017-01-05, 19:20
I prepared the branch lp:~widelands-dev/widelands/production_statistics, the syntax can be seen here e.g.: Top Quote |
SirVer |
Posted at: 2017-01-05, 22:32
Very cool, Tibor! Thanks for working on this. I have one comment though: creating the LuaTable with all possible entries is pretty expensive. For that reason, I used a function and gave the caller the choice what she is interested in in (most) other classes that give access to wares or workers. I think you can reuse this API (and the parsing functions for the parameters are already implemented). The API is described here: HasWares and here is the example implementation for Flag. There are other implementors in the Lua API. Top Quote |
Tibor |
Posted at: 2017-01-05, 22:45
I was considering this approach, but e.g. small problem is here: http://bazaar.launchpad.net/~widelands-dev/widelands/animation_manager/view/8190/src/scripting/lua_map.cc#L173 - this is defined in lua_map.cc and I would need it in lua_game.cc. Maybe if I moved it in other file? Top Quote |
SirVer |
Posted at: 2017-01-08, 16:25
Yes, why not. Just create a new one just for these functions seems fine. Top Quote |
Tibor |
Posted at: 2017-01-08, 17:07
In the meantime I wrote it from scratch in my function, it is now waiting for review, "production_statistics" branch. But I can rewrite it once more as separate function and in separate branch, if needed Top Quote |