[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: lua globals and C code
- From: Asko Kauppi <Asko.Kauppi@...>
- Date: Wed, 28 Aug 2002 11:24:45 +0300
Does that mean that you must compile the Lua engine into each and every
dynamic module you do? After all, you need a way to do something with the
'lua_State' pointer...
- Asko Kauppi
Flextronics Finland
--
Flextronics Design Finland
Box 23, 39201 Kyröskoski, Finland
+358 205 345 251 phone
+358 205 345 332 fax
www.flextronics.com
> -----Original Message-----
> From: Denis Andreev [SMTP:denq@mail.ru]
> Sent: Wednesday, August 28, 2002 11:07 AM
> To: Multiple recipients of list
> Subject: Re: lua globals and C code
>
>
> Hi!
>
> We use our own dynamic package system (luax).
>
> GAA> poslib = {}
> GAA> local f, e = loadlib("lposlib.dll", "lua_poslibopen")
> GAA> if not f then
> GAA> error(e)
> GAA> end
> GAA> setglobals(f, poslib) -- (this does not work)
> GAA> f()
> GAA> But, I cannot set the globals table for a C function
>
> May by you try this may:
>
> poslib = {}
> local f, e = loadlib("lposlib.dll", "lua_poslibopen")
> assert(f, e)
> f(poslib)
>
> and in your C code:
>
> static int poslib_globals_ref = 0;
>
> static int lua_poslibopen(lua_Stack *L) {
> poslib_globals_ref = lua_ref(L, 1);
> ...
> return 0
> }
>
> And in other functions you may use this reference.
>
> --Denq
###########################################
This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange.