lua-users home
lua-l archive

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


Lua 3.2 Multi State Version

What is this?
This is a modified version of the 3.2 release. lua_state is no longer a
global variable but a parameter passed thruout the system. This is the
version that we use for uCore.

What is changed?
All functions prototype has the state added as lua_State *lua_state.
Aall function calls has L as the first parameter.
Macros are expanded to include state just like functions.
The lua_open function now returns a state.
All examples are changed to work with the changes.

What is the advantage of this version?
When creating multithreaded applications the programmer gain a higher
level of control and it makes the programming of multiple states easy.
>From a performance perspective (Only tested on the Win32 platform) the
Thread Local Storage is not very fast and with compilers optimizing
parameters in registers this is faster for multi-threaded Win32
applications. It also makes it very easy to control several state in a
single thread enviroment.

What are the problems with this?
This is not a official Lua release - therefor must all 3.th party
libraries be changed to confirm with the different calling convention.
There may be bug in this conversion - but as stated earlier - we use
this ourself. We hope that the Lua team will consider this option for
Lua 4.0.

What do I do now?
Download this file and replace all the .C and .H files with the files in
this ZIP. Modify your program to use the new syntax - Take a look at the
lua.c and luac.c files for a example.

This is still Lua 3.2 - Just with some added modifications - therefor
all license requirements still stands.

Download it from:

http://www.hougaard.com/lua

or

ftp://ftp.hougaard.com/lua/lua32ms.zip


Happy Coding

Erik Hougaard