lua-users home
lua-l archive

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


Hello,
 
I have no idea of what that you just said what that that is. But I bet that if I start researching MeetaTables on Google I'll understand it Quick Enough.
 
Thanks.
Robin

> Date: Mon, 3 Nov 2008 22:12:06 +0000
> From: lua@corsix.org
> To: lua@bazar2.conectiva.com.br
> Subject: Re: Bind Variables?
>
> If you want to do this, and make it feel natural to Lua, then it is a
> bit of a pig to do: Create a table (T), assign it a fresh metatable
> (MT), add an __index metamethod to MT which reads the value from the C
> structure and then add a __newindex metatable to MT which writes the
> value to the C structure.
>
> 2008/11/3 Robin-Vossen <robin-vossen@hotmail.com>:
> >
> > Hello,
> >
> > I am new to Embedding Lua to my C App.
> > I understand that you can Embed your Functions you coded in Pure C by:
> > luaL_reg(lua_State, "the character name of the function exposed to lua", the
> > function in C)
> > But, how can you Glue Variables like that?
> > Like
> > So I can put my config in Lua.
> > And link it easily to:
> > struct config {
> > int keyUp;
> > int keyLeft;
> > int keyRight;
> > int keyDown;
> >
> > int volumeEffect;
> > int volumeMusic;
> >
> > char playerName[9];
> > } *cfg;
> >
> >
> > Thanks.
> >
> > Robin
> > --
> > View this message in context: http://www.nabble.com/Bind-Variables--tp20288845p20288845.html
> > Sent from the Lua - General mailing list archive at Nabble.com.
> >
> >



Express yourself instantly with MSN Messenger! MSN Messenger