lua-users home
lua-l archive

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


1) You can put it in the registry under a unique key
2) you can make a userdata and put it in the userdata's environment table
3) probably some other ways to do this
...

wes

On Jan 17, 2008 1:01 PM, Rodrigo Araújo <alf.rodrigo@gmail.com> wrote:
> Hi there,
>
> A lua user will be able to access a structure like Settings.User.Name inside
> a Lua file at any moment.
> This said, these information are only available at C++ files, so I have 2
> problems:
>
> 1. I need to define in C++ a table (Settings) that has four other tables
> inside (User, Var, Position and Bin) and these have the attributes (User:
> name, age, status, Var: int1, int2, int3, Position: int4, int5, int6, Bin:
> char1, char2, char3)
> 2. I need to make these tables available for Lua users at any moment of the
> code through their names, like Settings.User.name or Settings.Var.int1.
>
> I know that lua_newtable(L) creates a new table on top of the stack, but
> that doesn't make it available through her own name (like Settings), the
> user would must have to receive this table as a return statement from some
> kind of function... Is there anyway to do it?
>
> Thanks in advance,
> Rodrigo Araujo
>