lua-users home
lua-l archive

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


That worked, plus I was calling lua_pcall(L,1,0,0) but the 1 had to be a 0... Thanks! ;-)

Brendan Dowling wrote:
I did it with something like the following.
Note this is untested. I'm just posting it because I'm bored and can't sleep.


void foo(int argc, char **argv)
{
 int i;

 lua_newtable(L);
 for (i=0; i<argc; i++) {
   lua_pushnumber(L, i);
   lua_pushstring(L, argv[i]);
   lua_settable(L, -3);
 }
 lua_setglobal(L, "argv");
}





On 3/30/07, L-28C <kixdemp@gmail.com> wrote:
Hello everyone!

How would I pass a char** to Lua? Maybe put all the elements in a table
with lua_createtable()? How?

Thanks in advance!