commit f6c6a55b36c6e6de77eda07cc79f9d49660e82aa
Author: Jon Bell <jondbell@protonmail.com>
AuthorDate: Sat Apr 25 17:42:49 2020 -0600
Commit: Jon Bell <jondbell@protonmail.com>
CommitDate: Sat Apr 25 17:42:49 2020 -0600
fix crashes caused by missing lua functions
---
source/p8GlobalLuaFunctions.h | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/source/p8GlobalLuaFunctions.h b/source/p8GlobalLuaFunctions.h
index 8b27913..e6f4d94 100644
--- a/source/p8GlobalLuaFunctions.h
+++ b/source/p8GlobalLuaFunctions.h
@@ -46,7 +46,7 @@ function del(a, dv)
if a==nil then return end
for i=1, #a do
if a[i]==dv then
- tremove(a, i)
+ table.remove(a, i)
return
end
end
@@ -65,6 +65,26 @@ costatus = coroutine.status
---------------------------------
sub = string.sub
+function tostr(val, hex)
+ local kind=type(val)
+ if kind == "string" then
+ return val
+ elseif kind == "number" then
+ if hex then
+ val=val*0x10000
+ local part1=bit32.rshift(bit.band(val, 0xFFFF0000), 16)
+ local part2=bit32.band(val, 0xFFFF)
+ return string.format("0x%04x.%04x", part1, part2)
+ else
+ return tostring(val)
+ end
+ elseif kind == "boolean" then
+ return tostring(val)
+ else
+ return "[" .. kind .. "]"
+ end
+end
+
---------------------------------
--Debug
---------------------------------