URL:
  <http://gna.org/patch/?1656>

                 Summary: Export specenum_gen enums in the Lua event
scripting API
                 Project: Freeciv
            Submitted by: englabenny
            Submitted on: fredag 2010-04-30 den 17:37
                Category: None
                Priority: 5 - Normal
                  Status: Ready For Test
                 Privacy: Public
             Assigned to: englabenny
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: 2.3.0

    _______________________________________________________

Details:

With specenum we can easily export enums to lua using runtime name to
value lookup.

(Given progress with Matthias' patches on specenums, this looks like a very
good direction of development. The following patch only exports the events.h
specenum, the only one used in the API right now).

The looked-up value is written back to the lua table and thus every
lookup after the first will be looked up in the lua-side table
(remember, the __index metamethod in Lua is only a fallback).

api_specenum is exported by writing functions against the Lua C API
directly, without using tolua. This because the enum lookup is written
as template only once and can be instantiated for each specenum type.


Scripting API incompatibilities:
  Typos are not preserved (E.E_LOG_ERROR was exported, should have been and
is now E.LOG_ERROR)
  The 'E' table/module is no longer iterable (=introspectable) since it is
dynamically looked up.

I consider these incompatibilities trivial and nothing to worry about.



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: fredag 2010-04-30 den 17:37  Name:
2010043002-Export-specenum_gen-enums-in-the-Lua-event-scr.patch  Size: 13 kB 
 By: englabenny

<http://gna.org/patch/download.php?file_id=9093>

    _______________________________________________________

Reply to this item at:

  <http://gna.org/patch/?1656>

_______________________________________________
  Meddelandet skickades via/av Gna!
  http://gna.org/


_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to