lua-users home
lua-l archive

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


Hello Mike,

MP> Stukov wrote:
>> Please help me to find my mistake in 5.1 alpha compilation.

MP> It's not a problem with your compilation.

>> After  module(...) all global variables is undefined!

MP> This is documented in the manual that accompanies Lua 5.1 alpha.
MP> Read the comments for package.seeall(), too.

MP> What you really want to do is:
>>...........

Thank you, but it's unexpected surprise :\
My program use a lot of modules , and has hundreds
global variables declared with tolua ( not fast thing too ). Some one
else, and speed will be too close to JScript I think :(
May be I do something wrong, or Lua is not a right choice for task
like this:
---------------------------------------------------------------------
|                                                         |
| luaL_newstate                                                      |
| global variables defined in C (MsgBox)                             |
|                                                                    |
| --------------------  --------------------  ---------------------  |
| | script A          | | script B          | | script C           | |
| |                   | |                   | |  somevar=5         | |
| |  function f1()    | |  function f1()    | |  function f1()     | |
| |   B.f1()          | |      C.fC(fB)     | |       A.fA()       | |
| |  end              | |  end              | |  end               | |
| |                   | |                   | |                    | |
| |  function fA()    | |  function fB(str) | |  function fC(func) | |
| |  MsgBox(A.somevar)| |      MsgBox(str)  | |     func("hello")  | |
| |                   | |      C.f1()       | |                    | |
| |  end              | |  end              | |  end               | |
| |                   | |                   | |                    | |
| |-------------------  |-------------------  |--------------------  |
| call A.f1()                                                        |                                                                                                 |
|       .... and ~100-200 may be more same scripts up to 200kb and   |
|--------------------------------------------------------------------|

and this all in one thread, scripts added with
luaL_loadstring & lua_pcall

---------
module("A")
......
---------

lua_dostring("require "A" ")

some scripts added in runtime, some removed...

Or may be another decision?


-- 
Best regards,
Stukov
mailto:Stukov@gala.net