lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

> Sorry to sound discouraging, but aren't you trying to go the hard way?
> What considerations lead you to decision to change Lua itself? I
> believe you'll lose much more than you gain (starting from LuaJIT
> compatibility).
> Why not, say, wrap access to "shared" tables into some API calls (if
> needed, it may be made transparent by implementing a clever metatable
> over a global environment)? Such API may call yield as needed then (if
> you put into a metatable, you'll need to employ one of
> cross-metamethod yielding libraries).
> Alexander.
It's probably doable, but I think it leads to awkward code:

    1. The script programmers would then have to keep track of which
tables are foreign vs. local.
    2. Code becomes bulky (and maybe slow):


          instead of


    3. I investigated the metamethod idea - there's no way to define a
metamethod for changing an existing key, as in the above example. (Right?)
    4. Tables can point to other tables to form complex data structures.
Without a global ID for each table, knowing which tables to send to
connected players becomes a nightmare. Requiring programmers to always
initialize this for each table is error prone, and interferes with
garbage collection because now an "empty" table isn't really empty.