[SOLVED] `pcall(...)` inside `Canvas:renderTo(...)`
Posted: Sun Apr 29, 2018 7:42 am
Hey all!
I'm trying to do a `pcall(...)` inside a `Canvas:renderTo(...)`, which looks as follows (with the `print(...)` calls added for debugging):
The hope here is to allow other code to do `renderTo(function() ... end)` with possibly an error occurring in the `...`.
It works fine when there is no error raised by `func`, but when it does raise an error, I get:
I can confirm that both 'before' and 'after' are successfully printed before this error occurs. Wondering if there is something I may be missing here.
FWIW, I am on 11.0, will try upgrading to 11.1 soon.
I'm trying to do a `pcall(...)` inside a `Canvas:renderTo(...)`, which looks as follows (with the `print(...)` calls added for debugging):
Code: Select all
function renderTo(func)
if canvas then
canvas:renderTo(function()
print('before')
pcall(func)
print('after')
end)
end
end
It works fine when there is no error raised by `func`, but when it does raise an error, I get:
Code: Select all
Error: [string "boot.lua"]:514: present cannot be called while a Canvas is active.
FWIW, I am on 11.0, will try upgrading to 11.1 soon.