summaryrefslogtreecommitdiff
path: root/lib/luavgl/examples/protectedcall.lua
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2023-11-12 19:14:09 +1100
committerjacqueline <me@jacqueline.id.au>2023-11-12 19:14:09 +1100
commit8a0a167adbf3d9b6f8b6f16aaf20ca39ad5549de (patch)
tree02b6cf23f591915747ec2994381854a79979c4a0 /lib/luavgl/examples/protectedcall.lua
parent8471046a95ab9e00f7d42b56dbbc9ce3e5b424b9 (diff)
downloadtangara-fw-8a0a167adbf3d9b6f8b6f16aaf20ca39ad5549de.tar.gz
Convert the main menu screen to lua lol
Diffstat (limited to 'lib/luavgl/examples/protectedcall.lua')
-rw-r--r--lib/luavgl/examples/protectedcall.lua36
1 files changed, 36 insertions, 0 deletions
diff --git a/lib/luavgl/examples/protectedcall.lua b/lib/luavgl/examples/protectedcall.lua
new file mode 100644
index 00000000..a23fd9db
--- /dev/null
+++ b/lib/luavgl/examples/protectedcall.lua
@@ -0,0 +1,36 @@
+
+local function testCrash()
+ print(nil .. "")
+end
+
+local function testCrash2()
+ testCrash()
+end
+local function testCrash3()
+ testCrash2()
+end
+local function testCrash4()
+ testCrash3()
+end
+
+local function testCrash5()
+ testCrash4()
+end
+
+local function testCrash6()
+ testCrash5()
+end
+
+lvgl.Label(nil, {
+ text = "crash in 1 second.",
+ align = lvgl.ALIGN.CENTER
+})
+
+lvgl.Timer {
+ period = 1000,
+ cb = function(t)
+ t:delete()
+ -- crash in callback function is protected.
+ testCrash6()
+ end
+} \ No newline at end of file