summaryrefslogtreecommitdiff
path: root/example/script/match_12345.lua
diff options
context:
space:
mode:
authorpengxuanzheng <[email protected]>2020-08-24 17:10:55 +0800
committerpengxuanzheng <[email protected]>2020-08-24 17:10:55 +0800
commit503f4af4d8514913eb2ad0405b557abfd4326976 (patch)
tree5dd4f67e39f543c1cb1e2048eae0c0f720691c58 /example/script/match_12345.lua
Initial commit
Diffstat (limited to 'example/script/match_12345.lua')
-rw-r--r--example/script/match_12345.lua24
1 files changed, 24 insertions, 0 deletions
diff --git a/example/script/match_12345.lua b/example/script/match_12345.lua
new file mode 100644
index 0000000..c795bd3
--- /dev/null
+++ b/example/script/match_12345.lua
@@ -0,0 +1,24 @@
+local str = tsg.data
+local len = string.len(str)
+local thread_id = string.byte(str, len)
+local str = string.format("[lua][thread_id:%d][match_12345.lua]:str:%s, len:%d", thread_id, str, len - 1)
+print(str)
+local i = 0
+for i = 1, string.len(str) do
+ if string.byte(str, i) == 1 then
+ if string.byte(str, i + 1) == 2 then
+ if string.byte(str, i + 2) == 3 then
+ if string.byte(str, i + 3) == 4 then
+ if string.byte(str, i + 4) == 5 then
+ local str = string.format("[lua][thread_id:%d][match_12345.lua]:return %d, %s", thread_id, 1, "true")
+ print(str)
+ return 1, true
+ end
+ end
+ end
+ end
+ end
+end
+local str = string.format("[lua][thread_id:%d][match_12345.lua]:return %d, %s", thread_id, 1, "false")
+print(str)
+return 1, false