To access the parameters from lua, you can use:
UnitDefs[unitDefID].customParams (a normal table).
All keys and values in the UnitDefs[].customParams
table are strings. You'll have to do your own string to
number (or bool) conversion in lua.
Note that this info is available to AIs using:
AICallback::GetUnitDef(unitID)->customParams
[const std::map<std::string, std::string>]
ex: (in unit.fbi)
Code: Select all
[UNITINFO]
{
...
...
...
[CustomParams]
{
can_dance=1;
// LuaRules/Gadgets/unit_morph.lua parameters
morph_to=armdecom;
morph_time=20;
morph_metal=1000;
morph_energy=5000;
// LuaRules/Gadgets/unit_factory.lua parameters
fac_power=200;
fac_build0=armmav;
fac_build1=armack;
fac_build2=armwar;
}
}
parser converts all keys to lower case, and it's readable.