commit 37ec45027647ea529a314dc09d6e36279230e9cc
Author: Jon Bell <j.to.the.bell@gmail.com>
AuthorDate: Fri Jan 2 10:11:19 2026 -0700
Commit: Jon Bell <j.to.the.bell@gmail.com>
CommitDate: Fri Jan 2 10:11:19 2026 -0700
add stop and assert to lua sandbox
---
source/p8GlobalLuaFunctions.h | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/source/p8GlobalLuaFunctions.h b/source/p8GlobalLuaFunctions.h
index cee1f29..884801f 100644
--- a/source/p8GlobalLuaFunctions.h
+++ b/source/p8GlobalLuaFunctions.h
@@ -124,6 +124,19 @@ sub = string.sub
pack = table.pack
unpack = table.unpack
+function stop()
+ __z8_stopped = true
+ --error()
+end
+
+function assert(cond, msg)
+ if not cond then
+ color(14) print("assertion failed:")
+ color(6) print(msg or "assert()")
+ stop()
+ end
+end
+
function cartdata(s)
if __cartdata() then
print('cartdata() can only be called once')