X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=mailbox.lua;h=dc02521df01c470c10fb51ad446235053699577a;hb=5afbde77a331e8597f0f4478045c346fb93fde72;hp=dbfd09e3375e2d2ed7fac10e517b1e43f8b65c00;hpb=a64dbfca472cbd137ff6404db5ff8573e0c66d4a;p=xdecor.git diff --git a/mailbox.lua b/mailbox.lua index dbfd09e..dc02521 100644 --- a/mailbox.lua +++ b/mailbox.lua @@ -7,9 +7,8 @@ local function img_col(stack) if def.inventory_image ~= "" then return def.inventory_image:match("(.*)%.png")..".png" - else - return def.tiles[1]:match("(.*)%.png")..".png" end + return def.tiles[1]:match("(.*)%.png")..".png" end function mailbox:formspec(pos, owner, num) @@ -19,10 +18,12 @@ function mailbox:formspec(pos, owner, num) if num == 1 then for i = 1, 7 do - if meta:get_string("giver"..i) ~= "" then - local giver_name = meta:get_string("giver"..i):sub(1,12) - local stack_name = meta:get_string("stack"..i):match("[%w_:]+") - local stack_count = meta:get_string("stack"..i):match("%s(%d+)") or 1 + local giving = meta:get_string("giver"..i) + if giving ~= "" then + local stack = meta:get_string("stack"..i) + local giver_name = giving:sub(1,12) + local stack_name = stack:match("[%w_:]+") + local stack_count = stack:match("%s(%d+)") or 1 giver = giver.."#FFFF00,"..giver_name..","..i..",#FFFFFF,x "..stack_count.."," -- Hack to force using a 16px resolution for images in formspec's tablecolumn.