[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: How do I add a "local" using the c api
- From: "Tom Miles" <Tom@...>
- Date: Tue, 31 Mar 2009 16:15:19 +0100
>
> > 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.
>
> Which script? A local more or less by definition is only accessible to
> a single script so it doesn't make sense to talk about adding a local
> to be accessed by an independent script. I'm going to assume that
> there is simply a misunderstanding here between your intention and the
> question coming through to the list due to some missing key detail.
>
Urm, how to put this another way...
When I create a state, I load an associated script file. I want to add
some variables into the state the script is running in that are only
visible to that script. I can add globals using lua_setglobal(L,
"myvar"), or even lua_setfield(L, LUA_GLOBALSINDEX, "myvar"), but there
doesn't seem to be an equivelant for locals.