[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: RE: How do I add a "local" using the c api
- From: "Tom Miles" <Tom@...>
- Date: Tue, 31 Mar 2009 14:45:38 +0100
> > In short, how do I achieve something like this from the c api when I
> > create my state?
> > -- script start
> > local MAX_LIMIT = 10
> > -- lots of functions that use MAX_LIMIT everywhere
> > -- end script
> > (Short script huh!)
> > Thanks for any help,
> The C stack is where you would put local variables.
> int my_func (lua_State *L)
> lua_settop(L, max_arguments_allowed);
> lua_pushinteger(L, 10); /* <-- MAX_LIMIT is at max_arguments_allowed
> + 1 */
> /* do stuff with that value */
> return 0;
Thanks for the quick response, but I think you're misunderstanding my intentions. What I want to do is add a "local" variable in C, for a lua script to access.