[Lua] Fix EnforceNumberAndPack for bool type (#6576)

This commit is contained in:
罗泽轩
2021-04-20 05:30:20 +08:00
committed by GitHub
parent 0c77775966
commit 1045d7dd44
2 changed files with 2 additions and 1 deletions

View File

@@ -73,7 +73,7 @@ local bool_mt =
ValidNumber = function(self, n) return true end, -- anything is a valid boolean in Lua
EnforceNumber = function(self, n) end, -- anything is a valid boolean in Lua
EnforceNumbers = function(self, a, b) end, -- anything is a valid boolean in Lua
EnforceNumberAndPack = function(self, n) return self:Pack(value) end,
EnforceNumberAndPack = function(self, n) return self:Pack(n) end,
}
local uint8_mt =

View File

@@ -17,6 +17,7 @@ local function checkReadBuffer(buf, offset, sizePrefix)
assert(mon:Hp() == 80, "Monster Hp is not 80")
assert(mon:Mana() == 150, "Monster Mana is not 150")
assert(mon:Name() == "MyMonster", "Monster Name is not MyMonster")
assert(mon:Testbool() == true)
local vec = assert(mon:Pos(), "Monster Position is nil")
assert(vec:X() == 1.0)