diff options
| author | Jeija <norrepli@gmail.com> | 2013-02-12 10:25:24 +0100 | 
|---|---|---|
| committer | Jeija <norrepli@gmail.com> | 2013-02-12 10:25:24 +0100 | 
| commit | eeed4f148d95dd418ecee54fc6dfb22ab47f5f1b (patch) | |
| tree | cceeb97c97d68f4e8c24a46e19535bb461370dbc | |
| parent | 10ea3c971b21cd2232a542d330280007fa743fc4 (diff) | |
Fix odd behaviour when using interrupts in the luacontroller
| -rw-r--r-- | mesecons_luacontroller/init.lua | 4 | 
1 files changed, 3 insertions, 1 deletions
| diff --git a/mesecons_luacontroller/init.lua b/mesecons_luacontroller/init.lua index 91551a1..5141f8a 100644 --- a/mesecons_luacontroller/init.lua +++ b/mesecons_luacontroller/init.lua @@ -162,9 +162,10 @@ end  local getinterrupt = function(pos)  	local interrupt = function (time, iid) -- iid = interrupt id  		if type(time) ~= "number" then return end +		local iid = iid or math.random()  		local meta = minetest.env:get_meta(pos)  		local interrupts = minetest.deserialize(meta:get_string("lc_interrupts")) or {} -		table.insert (interrupts, iid or 0) +		table.insert (interrupts, iid)  		meta:set_string("lc_interrupts", minetest.serialize(interrupts))  		minetest.after(time, interrupt, {pos=pos, iid = iid})  	end @@ -297,6 +298,7 @@ local reset_meta = function(pos, code, errmsg)  end  local reset = function (pos) +	minetest.env:get_meta(pos):set_string("lc_interrupts", "")  	action(pos, {a=false, b=false, c=false, d=false}, true)  end | 
