replace lua Random implementation with usertype

This commit is contained in:
MihailRis
2025-09-25 23:53:11 +03:00
parent 3a40162f1e
commit 088bf63f3f
7 changed files with 115 additions and 38 deletions
+8
View File
@@ -169,5 +169,13 @@ State* lua::create_state(const EnginePaths& paths, StateType stateType) {
auto file = "res:scripts/stdmin.lua";
auto src = io::read_string(file);
lua::pop(L, lua::execute(L, 0, src, "core:scripts/stdmin.lua"));
newusertype<LuaRandom>(L);
if (getglobal(L, "random")) {
if (getglobal(L, "__vc_Random")) {
setfield(L, "Random");
}
pop(L);
}
return L;
}