Example #1
0
// Enum *e = Module:EnumCreate(name)
int li_module_enum_create(lua_State *L)
{
	CHECK_COUNT("enumCreate",2)
	CHECK_ARGUMENT("enumCreate",2,string)
	
	// check we have a module, then convert it to a Module
	CHECK_ARGUMENT_TYPE("typeCreate",1,Module,m)

	// now create the Enum
	Enum *e = new Enum(m, new std::string(lua_tostring(L, 2)));
	if(e == NULL) gen_error("enum could not be created");
	
	// now add this enum to the module
	m->objectAdd(new std::string(luaL_checkstring(L, 2)), e);
	
	CREATE_TABLE(L, e);
	e->lua_table(L);
		
	// now we just return the table :)
	return 1;
}