summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--server/src/vm/value.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/server/src/vm/value.lua b/server/src/vm/value.lua
index 1c7fe04e..7e2c3663 100644
--- a/server/src/vm/value.lua
+++ b/server/src/vm/value.lua
@@ -4,6 +4,13 @@ local listMgr = require 'vm.list'
local Sort = 0
local Watch = setmetatable({}, {__mode = 'kv'})
+local TypeLevel = {
+ ['table'] = 1.0,
+ ['function'] = 0.9,
+ ['string'] = 0.8,
+ ['integer'] = 0.7,
+ ['number'] = 0.6,
+}
local mt = {}
mt.__index = mt
@@ -86,6 +93,13 @@ function mt:getType()
if rate > mRate then
mRate = rate
mType = tp
+ elseif rate == mRate then
+ local level1 = TypeLevel[rate] or 0.0
+ local level2 = TypeLevel[mRate] or 0.0
+ if level1 > level2 then
+ mRate = rate
+ mType = tp
+ end
end
end
return mType or 'any'