|
Am 21.12.2012 um 14:42 schrieb Roberto Ierusalimschy:
Sorry, I have confused with lua_pcall (the C fuction). So I just
>>> Or better yet, call lua_error in the first place (instead of throwing
>>> a C++ exception). In Lua, you can catch such errors with 'pcall'.
>>
>>
>> Can I catch this error on the Lua script? [...]
>
>>> ................. In Lua, you can catch such errors with 'pcall'.
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
run a lua function with
if pcall(myfunc()) then
no error
else
error
end
A try-catch around a block does not work, so I must call each "function"
with pcall, do I ?
Thanks
Phil