mirror of
				https://github.com/luanti-org/luanti.git
				synced 2025-11-04 09:15:29 +01:00 
			
		
		
		
	Move setlocale from Lua to C++.
				
					
				
			This commit is contained in:
		@@ -21,7 +21,6 @@ if core.print then
 | 
			
		||||
	core.print = nil -- don't pollute our namespace
 | 
			
		||||
end
 | 
			
		||||
math.randomseed(os.time())
 | 
			
		||||
os.setlocale("C", "numeric")
 | 
			
		||||
minetest = core
 | 
			
		||||
 | 
			
		||||
-- Load other files
 | 
			
		||||
@@ -47,7 +46,6 @@ elseif INIT == "mainmenu" then
 | 
			
		||||
elseif INIT == "async" then
 | 
			
		||||
	dofile(asyncpath .. "init.lua")
 | 
			
		||||
elseif INIT == "client" then
 | 
			
		||||
	os.setlocale = nil
 | 
			
		||||
	dofile(clientpath .. "init.lua")
 | 
			
		||||
else
 | 
			
		||||
	error(("Unrecognized builtin initialization type %s!"):format(tostring(INIT)))
 | 
			
		||||
 
 | 
			
		||||
@@ -118,6 +118,9 @@ ScriptApiBase::ScriptApiBase(ScriptingType type):
 | 
			
		||||
 | 
			
		||||
	lua_pushstring(m_luastack, porting::getPlatformName());
 | 
			
		||||
	lua_setglobal(m_luastack, "PLATFORM");
 | 
			
		||||
 | 
			
		||||
	// Make sure Lua uses the right locale
 | 
			
		||||
	setlocale(LC_NUMERIC, "C");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
ScriptApiBase::~ScriptApiBase()
 | 
			
		||||
 
 | 
			
		||||
@@ -261,8 +261,7 @@ void ScriptApiSecurity::initializeSecurityClient()
 | 
			
		||||
		"clock",
 | 
			
		||||
		"date",
 | 
			
		||||
		"difftime",
 | 
			
		||||
		"time",
 | 
			
		||||
		"setlocale",
 | 
			
		||||
		"time"
 | 
			
		||||
	};
 | 
			
		||||
	static const char *debug_whitelist[] = {
 | 
			
		||||
		"getinfo",
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user