[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Linking C variables and lua variables.
- From: erik@... (Erik Hougaard)
- Date: Tue, 1 Aug 2000 11:32:53 +0200
----- Original Message -----
> Is there a simple method in lua for "linking" variables so as to make
> them visible in both the lua code and the C code. For example Tcl
> includes a function Tcl_LinkVar(interp, name, ptr, type); which makes
> the C variable of the given type at the given location accessible
> through Tcl with the given name.
Simple datatypes does not live both places with Lua.. They exist only in the
global space or on the Lua stack. You should use
lua_getnumber(lua_getglobal("myVar")) and push/setglobal for accessing 'em.
Lua has the userdata datatype that holds a pointer so you can with that
datatype have some transparency.
/Erik