mirror of
				https://github.com/chibicitiberiu/rainmeter-studio.git
				synced 2024-02-24 04:33:31 +00:00 
			
		
		
		
	Lua: Object tables were left on stack, fixed.
This commit is contained in:
		| @@ -28,32 +28,31 @@ void LuaManager::Initialize() | ||||
| 	if (c_State == NULL) | ||||
| 	{ | ||||
| 		// Initialize Lua | ||||
| 		c_State = lua_open(); | ||||
|  | ||||
| 		// Initialize standard libraries except debug, modified from linit.c | ||||
| 		const luaL_Reg lualibs[] = | ||||
| 		{ | ||||
| 			{ "", luaopen_base }, | ||||
| 			{ LUA_LOADLIBNAME, luaopen_package }, | ||||
| 			{ LUA_TABLIBNAME, luaopen_table }, | ||||
| 			{ LUA_IOLIBNAME, luaopen_io }, | ||||
| 			{ LUA_OSLIBNAME, luaopen_os }, | ||||
| 			{ LUA_STRLIBNAME, luaopen_string }, | ||||
| 			{ LUA_MATHLIBNAME, luaopen_math }, | ||||
| 			{ NULL, NULL } | ||||
| 		}; | ||||
|  | ||||
| 		for (const luaL_Reg* lib = lualibs; lib->func; ++lib) | ||||
| 		{ | ||||
| 			lua_pushcfunction(c_State, lib->func); | ||||
| 			lua_pushstring(c_State, lib->name); | ||||
| 			lua_call(c_State, 1, 0); | ||||
| 		c_State = luaL_newstate(); | ||||
|  | ||||
| 		// Initialize standard libraries except debug, modified from linit.c | ||||
| 		const luaL_Reg lualibs[] = | ||||
| 		{ | ||||
| 			{ "", luaopen_base }, | ||||
| 			{ LUA_LOADLIBNAME, luaopen_package }, | ||||
| 			{ LUA_TABLIBNAME, luaopen_table }, | ||||
| 			{ LUA_IOLIBNAME, luaopen_io }, | ||||
| 			{ LUA_OSLIBNAME, luaopen_os }, | ||||
| 			{ LUA_STRLIBNAME, luaopen_string }, | ||||
| 			{ LUA_MATHLIBNAME, luaopen_math }, | ||||
| 			{ NULL, NULL } | ||||
| 		}; | ||||
|  | ||||
| 		for (const luaL_Reg* lib = lualibs; lib->func; ++lib) | ||||
| 		{ | ||||
| 			lua_pushcfunction(c_State, lib->func); | ||||
| 			lua_pushstring(c_State, lib->name); | ||||
| 			lua_call(c_State, 1, 0); | ||||
| 		} | ||||
|  | ||||
| 		// Register custom types and functions | ||||
| 		RegisterGlobal(c_State); | ||||
| 		RegisterMeasure(c_State); | ||||
| 		RegisterMeasure(c_State); | ||||
| 		RegisterMeter(c_State); | ||||
| 		RegisterMeterWindow(c_State); | ||||
| 	} | ||||
|   | ||||
| @@ -167,4 +167,5 @@ void LuaManager::RegisterMeasure(lua_State* L) | ||||
| 	luaL_register(L, "CMeasure", functions); | ||||
| 	lua_pushvalue(L, -1); | ||||
| 	lua_setfield(L, -2, "__index"); | ||||
| 	lua_pop(L, 1); | ||||
| } | ||||
|   | ||||
| @@ -169,4 +169,5 @@ void LuaManager::RegisterMeter(lua_State* L) | ||||
| 	luaL_register(L, "CMeter", functions); | ||||
| 	lua_pushvalue(L, -1); | ||||
| 	lua_setfield(L, -2, "__index"); | ||||
| 	lua_pop(L, 1); | ||||
| } | ||||
|   | ||||
| @@ -200,4 +200,5 @@ void LuaManager::RegisterMeterWindow(lua_State* L) | ||||
| 	luaL_register(L, "CMeterWindow", functions); | ||||
| 	lua_pushvalue(L, -1); | ||||
| 	lua_setfield(L, -2, "__index"); | ||||
| 	lua_pop(L, 1); | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Birunthan Mohanathas
					Birunthan Mohanathas