summaryrefslogtreecommitdiff
path: root/tests/MyGame/Example
diff options
context:
space:
mode:
author罗泽轩 <spacewanderlzx@gmail.com>2021-05-08 13:57:13 +0800
committerGitHub <noreply@github.com>2021-05-07 22:57:13 -0700
commit4525cd9c5609f41e6f82f219a8dfef89d73e207e (patch)
tree2e77e09b0bd544796cb72c3107ea9c47a5924239 /tests/MyGame/Example
parent47361baf61d635e65346d796c609d534e65d20d7 (diff)
downloadflatbuffers-4525cd9c5609f41e6f82f219a8dfef89d73e207e.tar.gz
flatbuffers-4525cd9c5609f41e6f82f219a8dfef89d73e207e.tar.bz2
flatbuffers-4525cd9c5609f41e6f82f219a8dfef89d73e207e.zip
[Lua] manipulate byte array as string (#6624)
* [Lua] manipulate byte array as string Sometimes it would be more effective than reading byte by byte * change according to the review * update
Diffstat (limited to 'tests/MyGame/Example')
-rw-r--r--tests/MyGame/Example/Monster.lua15
-rw-r--r--tests/MyGame/Example/TypeAliases.lua3
2 files changed, 18 insertions, 0 deletions
diff --git a/tests/MyGame/Example/Monster.lua b/tests/MyGame/Example/Monster.lua
index fbd2c74e..26b59d3b 100644
--- a/tests/MyGame/Example/Monster.lua
+++ b/tests/MyGame/Example/Monster.lua
@@ -62,6 +62,9 @@ function Monster_mt:Inventory(j)
end
return 0
end
+function Monster_mt:InventoryAsString(start, stop)
+ return self.view:VectorAsString(14, start, stop)
+end
function Monster_mt:InventoryLength()
local o = self.view:Offset(14)
if o ~= 0 then
@@ -160,6 +163,9 @@ function Monster_mt:Testnestedflatbuffer(j)
end
return 0
end
+function Monster_mt:TestnestedflatbufferAsString(start, stop)
+ return self.view:VectorAsString(30, start, stop)
+end
function Monster_mt:TestnestedflatbufferLength()
local o = self.view:Offset(30)
if o ~= 0 then
@@ -315,6 +321,9 @@ function Monster_mt:Flex(j)
end
return 0
end
+function Monster_mt:FlexAsString(start, stop)
+ return self.view:VectorAsString(64, start, stop)
+end
function Monster_mt:FlexLength()
local o = self.view:Offset(64)
if o ~= 0 then
@@ -518,6 +527,9 @@ function Monster_mt:VectorOfEnums(j)
end
return 0
end
+function Monster_mt:VectorOfEnumsAsString(start, stop)
+ return self.view:VectorAsString(98, start, stop)
+end
function Monster_mt:VectorOfEnumsLength()
local o = self.view:Offset(98)
if o ~= 0 then
@@ -540,6 +552,9 @@ function Monster_mt:Testrequirednestedflatbuffer(j)
end
return 0
end
+function Monster_mt:TestrequirednestedflatbufferAsString(start, stop)
+ return self.view:VectorAsString(102, start, stop)
+end
function Monster_mt:TestrequirednestedflatbufferLength()
local o = self.view:Offset(102)
if o ~= 0 then
diff --git a/tests/MyGame/Example/TypeAliases.lua b/tests/MyGame/Example/TypeAliases.lua
index 91c62c44..e9c680b1 100644
--- a/tests/MyGame/Example/TypeAliases.lua
+++ b/tests/MyGame/Example/TypeAliases.lua
@@ -102,6 +102,9 @@ function TypeAliases_mt:V8(j)
end
return 0
end
+function TypeAliases_mt:V8AsString(start, stop)
+ return self.view:VectorAsString(24, start, stop)
+end
function TypeAliases_mt:V8Length()
local o = self.view:Offset(24)
if o ~= 0 then