[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: How to create Lua nested namespaces in C
- From: "E. Wing" <ewmailing@...>
- Date: Tue, 30 Nov 2004 05:20:49 -0800
Thank you! The code is very much appreciated! This is exactly what I needed.
> From: Malte Thiesen <firstname.lastname@example.org>
> I use the following code to create nested tables. The function takes a
> Lua-state and a string like "very.deeply.nested" and then creates all
> the subtables down to "nested" and leaves the "deepest" table on the stack.
> It also makes sure that the tables aren't overwritten, so if you create
> "very.deeply.nested" and "very.deeply" already exists only "nested" is
> created. Unlike you I use std::string not C-strings so you may have to
> adapt the code a little.
> bool CreateNestedTable(lua_State * L, const std::string & TableName)