Project

General

Profile

Actions

Feature #55

open

Universal converter functions for Lua API

Added by Alexandr Ignatiev 5 months ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
General
Target version:
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 current find.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.

No data to display

Actions

Also available in: Atom PDF