make my eyes happier: Random is now deprecated, moved lots of code around in a way that makes more sense and better LuaUserData error handling
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
local compatibilityLib = {}
|
||||
|
||||
LuaUserData.AddMethod(LuaUserData.RegisterType("Barotrauma.LuaSetup+LuaUserData"), "AddCallMetaMember", function (v)
|
||||
LuaUserData.AddMethod(LuaUserData.RegisterType("Barotrauma.LuaUserData"), "AddCallMetaMember", function (v)
|
||||
print("AddCallMetaMember is deprecated, use debug.setmetatable instead.")
|
||||
end)
|
||||
|
||||
@@ -10,6 +10,18 @@ compatibilityLib.CreateVector2 = Vector2.__new
|
||||
compatibilityLib.CreateVector3 = Vector3.__new
|
||||
compatibilityLib.CreateVector4 = Vector4.__new
|
||||
|
||||
local luaRandom = {}
|
||||
|
||||
luaRandom.Range = function (min, max)
|
||||
return math.random(min, max)
|
||||
end
|
||||
|
||||
luaRandom.RangeFloat = function (min, max)
|
||||
return math.random() + math.random(min, max)
|
||||
end
|
||||
|
||||
compatibilityLib["Random"] = luaRandom
|
||||
|
||||
local luaPlayer = {}
|
||||
|
||||
luaPlayer.GetAllCharacters = function ()
|
||||
|
||||
Reference in New Issue
Block a user