From: Antonio Scuri <scuri@tecgraf.puc-rio.br>
Reply-To: Lua list <lua@bazar2.conectiva.com.br>
To: Lua list <lua@bazar2.conectiva.com.br>
Subject: Re: IUP - Obtaining the Ihandle in C from Lua
Date: Thu, 22 Dec 2005 13:57:06 -0200
At 13:18 22/12/2005, Mark Meijer wrote:
Hi, I'm not sure if this is the right place for this question. If not,
then I appologize. I was wondering how to hand my C code the Ihandle of an
IUP element (in my case a regular dialog) that was created from within a
lua script. I found the page in the manual (also in the new version, where
it is found under System -> Guide > Other -> IupLua Advanced) mentioning
lua_unboxpointer in (Lua 5), but I have no idea what is meant by this and
there is no further explanation. I did a full text search for
"lua_unboxpointer" in the lua sources as well as the IUP sources and got
no hits, same when searching for just "unbox".
Does anyone know what I need? It also mentions lua_touserdata for lua 4,
is this what I need for lua 5 then as well? If so, what exactly would I
pass to the c function as argument, from the lua script, the dialog object
itself?
That paragraph is outdated. I removed refereces to lua_*boxpointer
because the code now works also in Lua 5.1.
You can use:
Ihandle* h = *(Ihandle**)lua_touserdata(L, idx);
Best,
scuri