lua-users home
lua-l archive

Re: Passing argv to Lua?

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


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!

AltStyle によって変換されたページ (->オリジナル) /