Fix crash in parsing colours

master
Pedro Gimeno 2017-12-27 13:51:47 +01:00
parent 3fd00c30ec
commit 42723886ae
1 changed files with 2 additions and 2 deletions

View File

@ -54,13 +54,13 @@ local function multicolour_light_effector_action(pos, node, channel, msg)
local configured_channel = minetest.get_meta(pos):get_string("digich")
if channel == configured_channel and type(msg) == "string" then
local node = minetest.get_node(pos)
local onoff, colour = msg:match("^([^#]+)#?(%x-)$")
local onoff, colour = msg:match("^([^#]*)#?(%x-)$")
if onoff == "off" and node.name == "digiplay:multicolour_light_on" then
node.name = "digiplay:multicolour_light"
elseif onoff == "on" and node.name == "digiplay:multicolour_light" then
node.name = "digiplay:multicolour_light_on"
end
if colour ~= "" then
if colour ~= "" and colour ~= nil then
local base
if colour:match("^%x%x%x%x%x%x$") then
base = 256