Lua Runtime Error: lua_pcall failed

I have recently been noticing very randomly occurring Runtime Errors in both simulator and android devices. I am using x-pressive Widget Candy Keyboard component in my applications and this error occasionally happens when the user hides the keyboard. Corona logs the following:

Lua Runtime Error: lua_pcall failed with status: 2, error
message is: ?:-1: attempt to call a table value

Usually the application just continues to run as if nothing has happened, but very rarely app freezes totally after this error. I am not able to attach any example code here since this involves x-pressives component and occurs very randomly, but I am curious if anyone has seen similar errors for example when using Corona widgets.

I did contact x-pressive.com and they are looking into it, but I think this could also be a Corona issue.

The error message indicates that somewhere, something is trying to make  a function call, but it’s using a table instead of a function.  Perhaps something is calling something with a colon when it should not be, like:

myObj:onComplete(someFunction)

actually is:

myObj.onComplete(self, someFunction)

and if the code inside onComplete takes the first parameter and tries to run it, it will give that error.

Rob

The error message indicates that somewhere, something is trying to make  a function call, but it’s using a table instead of a function.  Perhaps something is calling something with a colon when it should not be, like:

myObj:onComplete(someFunction)

actually is:

myObj.onComplete(self, someFunction)

and if the code inside onComplete takes the first parameter and tries to run it, it will give that error.

Rob

I have recently been noticing very randomly occurring Runtime Errors in both simulator and android devices. I am using x-pressive Widget Candy Keyboard component in my applications and this error occasionally happens when the user hides the keyboard. Corona logs the following:

Lua Runtime Error: lua_pcall failed with status: 2, error
message is: ?:-1: attempt to call a table value

Usually the application just continues to run as if nothing has happened, but very rarely app freezes totally after this error. I am not able to attach any example code here since this involves x-pressives component and occurs very randomly, but I am curious if anyone has seen similar errors for example when using Corona widgets.

I did contact x-pressive.com and they are looking into it, but I think this could also be a Corona issue.

Hi Sape, did you eventually find a solution to this problem? I encountered it yesterday when implementing the keyboard widget in my app and after some trial and error was still unable to determine the exact cause of the problem or prevent it from occurring.

In the end the only satisfactory and stable solution I could find was to ensure that all Keyboard_Remove() calls are immediate, rather than animated. Now, the keyboard slides in to view as expected but always disappears immediately when no longer needed; there is no slide out animation. It’s not a perfect solution but it’s error-free and consistent and that’s good enough for me. As Widget Candy makes an internal Keyboard_Remove(true) call it was necessary to implement the fix within the Keyboard_Remove() method itself. This ensures it always works. Here’s the simple solution…

-- REMOVE KEYBOARD V.Keyboard\_Remove = function (animate) local Tmp; local animate = false

The edit being " ; local animate = false" on line 1210, which always results in the keyboard being removed immediately, no matter what value is passed.

I’m guessing you solved the problem in a similar way yourself but thought I’d post this in case anyone else comes across this thread, as I did.

I have recently been noticing very randomly occurring Runtime Errors in both simulator and android devices. I am using x-pressive Widget Candy Keyboard component in my applications and this error occasionally happens when the user hides the keyboard. Corona logs the following:

Lua Runtime Error: lua_pcall failed with status: 2, error
message is: ?:-1: attempt to call a table value

Usually the application just continues to run as if nothing has happened, but very rarely app freezes totally after this error. I am not able to attach any example code here since this involves x-pressives component and occurs very randomly, but I am curious if anyone has seen similar errors for example when using Corona widgets.

I did contact x-pressive.com and they are looking into it, but I think this could also be a Corona issue.

Hi Sape, did you eventually find a solution to this problem? I encountered it yesterday when implementing the keyboard widget in my app and after some trial and error was still unable to determine the exact cause of the problem or prevent it from occurring.

In the end the only satisfactory and stable solution I could find was to ensure that all Keyboard_Remove() calls are immediate, rather than animated. Now, the keyboard slides in to view as expected but always disappears immediately when no longer needed; there is no slide out animation. It’s not a perfect solution but it’s error-free and consistent and that’s good enough for me. As Widget Candy makes an internal Keyboard_Remove(true) call it was necessary to implement the fix within the Keyboard_Remove() method itself. This ensures it always works. Here’s the simple solution…

-- REMOVE KEYBOARD V.Keyboard\_Remove = function (animate) local Tmp; local animate = false

The edit being " ; local animate = false" on line 1210, which always results in the keyboard being removed immediately, no matter what value is passed.

I’m guessing you solved the problem in a similar way yourself but thought I’d post this in case anyone else comes across this thread, as I did.