Actions
Feature #55
openUniversal converter functions for Lua API
Start date:
12/12/2023
Due date:
% Done:
0%
Estimated time:
Description
Make a bunch of universal converters that turn lua_Object into various API classes. This set is to be used in
find
module utilities and any other API functions, to make polymorphism uniform.
- The only sane converter between API types I can imagine is Nation_Type<->Player. Other, like Unit->Unit_Type, should be left to explicit functions.
- Things that have id's and/or rule_name's are converted from numbers and/or strings in obvious way.
- Things that have non-rule names (players and cities, maybe in the future units) should better be left to explicit
find.*()
calls, though for players maybe we can use string calls uniformly. - Tiles should be findable by a table with coordinates, by default
{nat_x, nat_y}
in natural coordinates (as currentfind.tile(a, b)
does), but should also support named{nat_x=1, nat_y=1}
and, with some priority,{x=1,y=1}
for map coords and{native_x=1, native_y=1}
for native pos.
Actions