[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: how to pass C structure to Lua
- From: "Honglei Tu" <honglei@...>
- Date: Sun, 4 Mar 2001 14:35:20 -0800
Hello,
If I want to use Lua 4.0 and will pass C structure to Lua,
how should I do ?
I am doing the code like this:
struct {
int red;
int green;
int blue;
} aTest;
lua_pushnumber(L, 1);
lua_pushnumber(L, aTest.red);
lua_pushnumber(L, 2);
lua_pushnumber(L, aTest.green);
lua_pushnumber(L, 3);
lua_pushnumber(L, aTest.blue);
lua_settable(L, 1);
I get an error in lua_settable(L, 1).
It seems that the index is wrong.
Can anyone tell me how to do?
Honglei