From 5f232e4aaaad5b56d970a425c532e95240f82491 Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Sat, 4 Aug 2012 10:54:43 +0100 Subject: SUPPLE: Better support for error messages, show them in the example --- example/simple-example.lua | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'example/simple-example.lua') diff --git a/example/simple-example.lua b/example/simple-example.lua index 33f62e8..327167f 100644 --- a/example/simple-example.lua +++ b/example/simple-example.lua @@ -44,3 +44,12 @@ setmetatable(tab, mt) -- Finally, run the subcode print(supple.host.run(subcode, "@test-code", tab)) assert(tab.tot == 24) + +-- Now run a supple command which we expect to error out. +print(supple.host.run("unknown()", "@test-code")) + +-- And now, one where we pass an error from host to sandbox and back +print(supple.host.run("local f = ... f()", "@test-code", function() unknown() end)) + +-- And now, one where we pass an error from sandbox to host to sandbox and back +print(supple.host.run("local f = ... f(function() unknown() end)", "@test-code", function(ff) ff() end)) -- cgit v1.2.1