mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 16:45:20 +02:00
Store vector metatable in registry
This commit is contained in:
committed by
GitHub
parent
11aab4198b
commit
06d197cdd0
@@ -121,6 +121,14 @@ ScriptApiBase::ScriptApiBase(ScriptingType type):
|
||||
lua_newtable(m_luastack);
|
||||
lua_setglobal(m_luastack, "core");
|
||||
|
||||
// vector.metatable is stored in the registry for quick access from C++.
|
||||
lua_newtable(m_luastack);
|
||||
lua_rawseti(m_luastack, LUA_REGISTRYINDEX, CUSTOM_RIDX_VECTOR_METATABLE);
|
||||
lua_newtable(m_luastack);
|
||||
lua_rawgeti(m_luastack, LUA_REGISTRYINDEX, CUSTOM_RIDX_VECTOR_METATABLE);
|
||||
lua_setfield(m_luastack, -2, "metatable");
|
||||
lua_setglobal(m_luastack, "vector");
|
||||
|
||||
if (m_type == ScriptingType::Client)
|
||||
lua_pushstring(m_luastack, "/");
|
||||
else
|
||||
|
Reference in New Issue
Block a user