Can mod Lua read tags?
Moderator: Moderators
Can mod Lua read tags?
For most uses of Lua in a mod it would be beneficial to say the least if variables used by the script could be adjusted easily, e.g. if someone implements a mana system to have the mana easily changeable for each unit or for a prerequisite system easily change the prerequisite. Thus I wonder if it's possible to make Lua read tags in the unit fbis? That would be synced Lua, of course. Can it do that kind of stuff?
Also, see Lua/LuaUnitDefs.cpp in game source. You can access all what's defined there if you do something like this:
Of course there's no need to define that mapping, I do it for convenience.
Code: Select all
unitDefByName = {}
for k,ud in pairs(UnitDefs) do
unitDefByName[ud.name] = ud
end
-- access here
unitDefByName[unitname goes here].param
-- eg. unitDefByName['Lord'].isBuilder returns true in nanoblobz