1 #ifndef AWFUL_LUA_MODULE_H
2 #define AWFUL_LUA_MODULE_H
4 namespace awful
{ namespace LuaImpl
8 ModuleVisitor( lua_State
* pLS_
) :
10 bAtGlobalScope( true )
14 // Called for each nested namespace until the namespace we're interested in.
15 // Create all intermediate namespace tables as needed.
16 // Also build the module name in the form module.submodule.subsubmodule
17 // to be able to set the package.loaded properly.
18 void QualifiedNameComponent( const char* pName_
)
22 FullModuleName
= pName_
;
23 lua_getglobal( pLS
, pName_
);
27 FullModuleName
+= '.';
28 FullModuleName
+= pName_
;
29 lua_getfield( pLS
, -1, pName_
);
32 if( lua_isnil( pLS
, -1 ) )
36 lua_pushvalue( pLS
, -1 );
40 lua_setglobal( pLS
, pName_
);
44 lua_setfield( pLS
, -3, pName_
);
45 lua_remove( pLS
, -3 );
49 bAtGlobalScope
= false;
52 template< class C
> void Class()
54 ClassStuff
< C
>::Setup();
57 template< class C
> void Struct()
59 StructStuff
< C
>::Setup();
64 std::string FullModuleName
;