Cool VL Viewer forum

View unanswered posts | View active topics It is currently 2024-03-28 13:43:19



Reply to topic  [ 12 posts ]  Go to page Previous  1, 2
Crash sometimes when using Lua CallbackAfter() 
Author Message

Joined: 2009-03-17 18:42:51
Posts: 5523
Reply with quote
ZaneZimer wrote:
I can't be certain, obviously, but I have not had a crash since I refactored my OnSendChat() callback to always ensure a return value. I must have, over the course of time and rework, omitted the return from one of my conditionals. I suspect it was when I was improving the check for a command just by doing a single find for the slash as opposed to trying to find each command, one after the other. I'll update this message thread if anything changes, but I think you were spot on with your diagnosis.
There was a flaw in my code anyway: on return of OnSendChat(), I was checking for the return type without checking first that anything got returned, for I made the (wrong) assumption that since I required one return value via the lua_pcall() to OnSendChat(), a Lua error would occur if no value was returned... In fact, no, lua_pcall() does not trigger any error when less return values than requested are returned (which could easily be considered a Lua bug...); it simply truncates the stack from any value in excess to the requested number...
I made the proper checks in today's release, to avoid such crashes and properly issue an error.


2017-04-29 09:27:49
Profile WWW

Joined: 2016-06-19 21:33:37
Posts: 337
Location: Columbus area, OH, USA
Reply with quote
Henri Beauchamp wrote:
I made the proper checks in today's release, to avoid such crashes and properly issue an error.
Nice. At least this clumsy scripter will get an error if he forgets the return value again. :-)


2017-04-30 13:44:09
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 12 posts ]  Go to page Previous  1, 2

Who is online

Users browsing this forum: No registered users and 31 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.