[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Passing argv to Lua?
- From: "Brendan Dowling" <crypt@...>
- Date: Sat, 31 Mar 2007 01:02:40 -0700
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!