[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Distributed Lua
- From: Olivier Hamel <evilpineapple@...>
- Date: Sat, 09 Jan 2010 15:59:12 -0500
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
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).
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):
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.
Using metatables you could very well use:
Transparently, you wouldn't even need to explicitly know it's a