[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Simulating Lua states in Lua with only 250 lines of code
- From: Dirk Laurie <dirk.laurie@...>
- Date: Tue, 23 Jun 2015 09:00:03 +0200
2015-06-23 3:51 GMT+02:00 Soni L. <fakedme@gmail.com>:
> Why can't we get a way to make independent Lua states from Lua,
> anyway? (or rather with isolated registry and global metatables - this
> means the GC would be shared between them, thus allowing objects
> to be shared between them, but they wouldn't share the same global
> metatables or the same globals table). It would open up great possibilities!
The presently available language features in that direction are:
1. debug.getregistry()[1], which contains the Lua state, and
debug.getregistry()[2], which contains the global table. These
are assignable. By "global metatable", do you mean things like
getmetatable("")?
2. Coroutines.
3. Loading code with a specified _ENV.
What additional functions, callable from Lua, would you need
for your envisaged ability? Can you describe them in terms of
currently available API routines, so that one can knock together
a little module in order to experiment with the idea?