3 ms·
I immediately thought of Lua as well. A fine choice, Lua has the best C FFI I've ever worked with. I love everything about this.
by weeksie 12y ago
I immediately thought of Lua as well. A fine choice, Lua has the best C FFI I've ever worked with. I love everything about this.
- cheez 12y agoDoes Lua work well with multiple threads?
- haberman 12y agoLua has full support for creating multiple interpreter instances (ie. there are no global variables, and it's totally re-entrant). But interpreter instances are not thread-safe. So the way to support multiple threads is to have completely independent interpreters running in different threads.
- cheez 12y agoThanks. Any idea as to the footprint of these instances?
- mempko 12y agoI use this approach in Fire★ (http://www.firestr.com http://www.firestr.com). Lua vm instances are tiny. There is a reason lua is used even in systems like nintendo DS
- sharkbot 12y agoYou can make a Lua interpreter thread safe by adding a GIL. There is implicit support for this in the code: the interpreter invokes lua_lock/lua_unlock at the proper places, the default Lua implementation just has them NOP'd out. Adding the thread primitives is up to you, however.
- chii 12y agowhen you have multiple threads, isn't the idea to share data between threads? I haven't really worked with embedded lua before - does lua help with that?