From 68c370327c5e9de847efa0b9d3e890673732f6ad Mon Sep 17 00:00:00 2001 From: cheapie Date: Tue, 1 Oct 2024 17:37:15 -0500 Subject: [PATCH] Fix crash when a tube emits a digilines signal (#5) Co-authored-by: cheapie --- init.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/init.lua b/init.lua index 0ff846a..fdd9c57 100644 --- a/init.lua +++ b/init.lua @@ -67,7 +67,7 @@ local on_digiline_receive_deca = function(pos, node, channel, msg) num = (tonumber(tubenum) or 0) + 1 if num > 9 then num = 0 - digilines:receptor_send(pos, digilines.rules.default, channel, "carry") + digilines.receptor_send(pos, digilines.rules.default, channel, "carry") end minetest.swap_node(pos, { name = "nixie_tubes:decatron_"..num, param2 = node.param2}) @@ -75,12 +75,12 @@ local on_digiline_receive_deca = function(pos, node, channel, msg) num = (tonumber(tubenum) or 0) - 1 if num < 0 then num = 9 - digilines:receptor_send(pos, digilines.rules.default, channel, "borrow") + digilines.receptor_send(pos, digilines.rules.default, channel, "borrow") end minetest.swap_node(pos, { name = "nixie_tubes:decatron_"..num, param2 = node.param2}) elseif msg == "get" then - digilines:receptor_send(pos, digilines.rules.default, channel, tubenum) + digilines.receptor_send(pos, digilines.rules.default, channel, tubenum) end end @@ -418,10 +418,10 @@ local on_digiline_receive_alnum = function(pos, node, channel, msg) if (asc > 30 and asc < 128) or asc == 144 then minetest.swap_node(pos, { name = "nixie_tubes:alnum_"..asc, param2 = node.param2}) elseif msg == "get" then -- get value as ASCII numerical value - digilines:receptor_send(pos, digilines.rules.default, channel, + digilines.receptor_send(pos, digilines.rules.default, channel, tonumber(string.match(minetest.get_node(pos).name,"nixie_tubes:alnum_(.+)"))) elseif msg == "getstr" then -- get actual char - digilines:receptor_send(pos, digilines.rules.default, channel, string.char( + digilines.receptor_send(pos, digilines.rules.default, channel, string.char( tonumber(string.match(minetest.get_node(pos).name,"nixie_tubes:alnum_(.+)")))) end end