Пример #1
0
	void lua_register_ldungeon(const LuaValue& submodule, bool register_lcommon = true) {
		lua_State* L = submodule.luastate();
		if (register_lcommon) {
			lua_register_lcommon(L);
		}
		lua_register_map(submodule);
		lua_register_areatemplate(submodule);
		lua_register_tunnelgen(submodule);
		register_libxmi_bindings(submodule);
	}
Пример #2
0
int luaopen_th(lua_State *L)
{
    lua_settop(L, 0);
    lua_checkstack(L, 16 + static_cast<int>(lua_metatable::count));

    lua_register_state oState;
    const lua_register_state *pState = &oState;
    oState.L = L;
    for(int i = 0; i < static_cast<int>(lua_metatable::count); ++i)
    {
        lua_createtable(L, 0, 5);
        oState.metatables[i] = lua_gettop(L);
    }
    lua_createtable(L, 0, lua_gettop(L));
    oState.main_table = lua_gettop(L);
    oState.top = lua_gettop(L);

    // Misc. functions
    lua_settop(L, oState.top);
    add_lua_function(pState, l_load_strings, "LoadStrings");
    add_lua_function(pState, l_get_compile_options, "GetCompileOptions");
    add_lua_function(pState, bootstrap_lua_resources, "GetBuiltinFont");

    // Classes
    lua_register_map(pState);
    lua_register_gfx(pState);
    lua_register_anims(pState);
    lua_register_sound(pState);
    lua_register_movie(pState);
    lua_register_strings(pState);
    lua_register_ui(pState);
    lua_register_lfs_ext(pState);

    lua_settop(L, oState.main_table);
    return 1;
}