Mailbox: minor code cleaning
This commit is contained in:
parent
c49978f25e
commit
5afbde77a3
13
mailbox.lua
13
mailbox.lua
@ -7,9 +7,8 @@ local function img_col(stack)
|
|||||||
|
|
||||||
if def.inventory_image ~= "" then
|
if def.inventory_image ~= "" then
|
||||||
return def.inventory_image:match("(.*)%.png")..".png"
|
return def.inventory_image:match("(.*)%.png")..".png"
|
||||||
else
|
|
||||||
return def.tiles[1]:match("(.*)%.png")..".png"
|
|
||||||
end
|
end
|
||||||
|
return def.tiles[1]:match("(.*)%.png")..".png"
|
||||||
end
|
end
|
||||||
|
|
||||||
function mailbox:formspec(pos, owner, num)
|
function mailbox:formspec(pos, owner, num)
|
||||||
@ -19,10 +18,12 @@ function mailbox:formspec(pos, owner, num)
|
|||||||
|
|
||||||
if num == 1 then
|
if num == 1 then
|
||||||
for i = 1, 7 do
|
for i = 1, 7 do
|
||||||
if meta:get_string("giver"..i) ~= "" then
|
local giving = meta:get_string("giver"..i)
|
||||||
local giver_name = meta:get_string("giver"..i):sub(1,12)
|
if giving ~= "" then
|
||||||
local stack_name = meta:get_string("stack"..i):match("[%w_:]+")
|
local stack = meta:get_string("stack"..i)
|
||||||
local stack_count = meta:get_string("stack"..i):match("%s(%d+)") or 1
|
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..","
|
giver = giver.."#FFFF00,"..giver_name..","..i..",#FFFFFF,x "..stack_count..","
|
||||||
-- Hack to force using a 16px resolution for images in formspec's tablecolumn.
|
-- Hack to force using a 16px resolution for images in formspec's tablecolumn.
|
||||||
|
Loading…
Reference in New Issue
Block a user