[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: how to pass C structure to Lua
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Sun, 4 Mar 2001 21:10:58 -0300 (EST)
>If I want to use Lua 4.0 and will pass C structure to Lua,
>how should I do ?
I assume you want to create a table that mirrors the C struct.
Int this case, the code is:
lua_newtable(L);
lua_pushstring(L,"red"); lua_pushnumber(L,aTest.red); lua_settable(L,-3);
lua_pushstring(L,"green"); lua_pushnumber(L,aTest.green); lua_settable(L,-3);
lua_pushstring(L,"blue"); lua_pushnumber(L,aTest.blue); lua_settable(L,-3);
The table is left on the top of the stack.
--lhf