[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: light user data
- From: "Wesley Smith" <wesley.hoke@...>
- Date: Tue, 3 Oct 2006 09:48:17 -0700
I'm trying to figure out how to use lua_pushlightuserdata. I have a function
put_data_in_lua(lua_State *L, void *mem)
{
// want get the mem into Lua
// how do I get it into a lua variable?
lua_puslightuserdata(L, mem); //is this right? how do assign
it to a variable?
}
static int process_data(lua_Stat *L)
{
//get user data and do something with it
}
static const struct luaL_Reg mylib [] = {
{"process", process_data},
{NULL, NULL}
};
extern int luaopen_mylib{lua_Stat *L)
{
luaL_register(L, "mylib", mylib);
return 1;
}
/***********************
Lua Script
*/
memory = nil
function setmem(mem)
memory = mem
end
function process_memory
memory.process()
end
thanks,
wes