diff options
author | 罗泽轩 <spacewanderlzx@gmail.com> | 2021-04-20 05:30:20 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-19 14:30:20 -0700 |
commit | 1045d7dd44c3876d73c12fb5780edca50ae39a4c (patch) | |
tree | 43f7861083e64cd413524cd113d6db284fd91383 | |
parent | 0c77775966ab446055a392cbd09b93168f02b6fc (diff) | |
download | flatbuffers-1045d7dd44c3876d73c12fb5780edca50ae39a4c.tar.gz flatbuffers-1045d7dd44c3876d73c12fb5780edca50ae39a4c.tar.bz2 flatbuffers-1045d7dd44c3876d73c12fb5780edca50ae39a4c.zip |
[Lua] Fix EnforceNumberAndPack for bool type (#6576)
-rw-r--r-- | lua/flatbuffers/numTypes.lua | 2 | ||||
-rw-r--r-- | tests/luatest.lua | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/lua/flatbuffers/numTypes.lua b/lua/flatbuffers/numTypes.lua index 01f41993..289fa59c 100644 --- a/lua/flatbuffers/numTypes.lua +++ b/lua/flatbuffers/numTypes.lua @@ -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 = diff --git a/tests/luatest.lua b/tests/luatest.lua index e60f837d..a2a9d639 100644 --- a/tests/luatest.lua +++ b/tests/luatest.lua @@ -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) |