lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I want to pass an array of userdata to a lua script, can I do it this way?

In c:
lua_newtable(l);
lua_pushstring(l, "1");	//Index
lua_pushlightuserdata(l,data);
lua_settable(l,-3)
....
lua_setglobal(l, "list");
lua_pushnumber(l,number_of_values);
lua_setglobal(l,"number");

And then in lua script:

for i=1,number do
  do something with list[i]....


-- 
Roger D. Vargas
ICQ: 117641572
Linux user: 180787
* Tanto si piensas que puedes, como si piensas que no puedes, tienes razón *
Henry Ford