main: Don't let action timeout fire after a script already finished

Tue, 11 Sep 2018 23:24:08 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Tue, 11 Sep 2018 23:24:08 +0100
changeset 134
ce945ba7a754
parent 133
e087dd875160
child 135
0c1887ee2059

main: Don't let action timeout fire after a script already finished

main.lua file | annotate | diff | comparison | revisions
--- a/main.lua	Tue Sep 11 23:06:24 2018 +0100
+++ b/main.lua	Tue Sep 11 23:24:08 2018 +0100
@@ -134,6 +134,7 @@
 end
 
 local function uninitialize_script(script)
+	script.finished = true;
 	for name, obj in pairs(script.objects) do
 		if obj.handler._finish then
 			obj.handler._finish(obj);
@@ -195,7 +196,7 @@
 			if action_timeout and action_timeout > 0 then
 				local action_number = i;
 				verse.add_task(action_timeout, function ()
-					if i == action_number then
+					if i == action_number and not script.finished then
 						local e = new_error("action-timeout", { text = "Timeout waiting for response" });
 						error(e);
 					end

mercurial