Closed nicsle closed 8 years ago
Which version of minetest are you using?
Oh sorry, I didn't wrote it? It's minetest 0.4.14.
Am 30.05.2016 um 22:24 schrieb Auke Kok:
Which version of minetest are you using?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/minetest-mods/xdecor/issues/51#issuecomment-222550350, or mute the thread https://github.com/notifications/unsubscribe/AMGI1xpepRyyK3m3Ncn-TT7lyPy6bdDjks5qG0eDgaJpZM4Ip8xP.
Can you check if the latest git tree fixes this problem for you?
Hi, sadly not :(
but now I get another error:
2016-05-31 21:58:21: ERROR[Main]: ServerError: Lua: Runtime error from
mod 'titanium' in callback item_OnPlace():
...t/minetest/bin/../games/minetest/mods/xdecor/mailbox.lua:13: attempt
to call method 'match' (a nil value)
2016-05-31 21:58:21: ERROR[Main]: stack traceback:
2016-05-31 21:58:21: ERROR[Main]:
...t/minetest/bin/../games/minetest/mods/xdecor/mailbox.lua:13: in
function 'img_col'
2016-05-31 21:58:21: ERROR[Main]:
...t/minetest/bin/../games/minetest/mods/xdecor/mailbox.lua:36: in
function 'formspec'
2016-05-31 21:58:21: ERROR[Main]:
...t/minetest/bin/../games/minetest/mods/xdecor/mailbox.lua:90: in
function 'on_rightclick'
2016-05-31 21:58:21: ERROR[Main]:
/home/minetest/minetest/bin/../builtin/game/item.lua:333: in function
</home/minetest/minetest/bin/../builtin/game/item.lua:326>
but I got the solution:
local function img_col(stack) local def = minetest.registered_items[stack] if not def then return "" end
if def.inventory_image ~= "" then
return def.inventory_image:match("(.*)%.png")..".png"
end
if def.tiles and def.tiles[1] then
minetest.log("ERROR",dump(def))
if type(def.tiles[1])=="table" then
return def.tiles[1].name:match("(.*)%.png")..".png"
end
if type(def.tiles[1])=="string" then
return def.tiles[1]:match("(.*)%.png")..".png"
end
end
return ""
end
Someone said me, that def.tiles[1] can be an array or a string. It's an array, if the node is animated. If it's an array, it looks like this:
tiles = { { name = "default_lava_source_animated.png", animation = { type = "vertical_frames", length = 3, aspect_h = 16, aspect_w = 16 } } },
Am 31.05.2016 um 16:38 schrieb Auke Kok:
Can you check if the latest git tree fixes this problem for you?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/minetest-mods/xdecor/issues/51#issuecomment-222708834, or mute the thread https://github.com/notifications/unsubscribe/AMGI1x-2ppmrqei6hMJn9_aNk4dxLs22ks5qHEfhgaJpZM4Ip8xP.
That means that your version of minetest is too old, and you need to upgrade to 0.4.14.
Sorry, I didn't read that properly the first time. Let me come up with a proper fix for this.
I always wrote you the solution in the last mail ^^
local function img_col(stack) local def = minetest.registered_items[stack] if not def then return "" end
if def.inventory_image ~= "" then
return def.inventory_image:match("(.*)%.png")..".png"
end
if def.tiles and def.tiles[1] then
if type(def.tiles[1])=="table" then
return def.tiles[1].name:match("(.*)%.png")..".png"
end
if type(def.tiles[1])=="string" then
return def.tiles[1]:match("(.*)%.png")..".png"
end
end
return ""
end
replace this with the img_col() in your mailbox.lua and it works fine :)
Am 01.06.2016 um 00:21 schrieb Auke Kok:
Sorry, I didn't read that properly the first time. Let me come up with a proper fix for this.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/minetest-mods/xdecor/issues/51#issuecomment-222839065, or mute the thread https://github.com/notifications/unsubscribe/AMGI19CIOt9w3r0nx-_mnCHkdb5IhTg9ks5qHLRigaJpZM4Ip8xP.
That's still not entirely right, nor safe, and you needlessly repeat the match
part 3x there as well. I'll write something safe and non-duplicating when I have some time.
Hi, when I'm trying to access the mailbox the game crashes and I got the following error:
2016-05-30 19:20:32: ERROR[Main]: ServerError: Lua: Runtime error from mod 'titanium' in callback item_OnPlace(): ...t/minetest/bin/../games/minetest/mods/xdecor/mailbox.lua:11: attempt to index field 'tiles' (a nil value) 2016-05-30 19:20:32: ERROR[Main]: stack traceback: 2016-05-30 19:20:32: ERROR[Main]: ...t/minetest/bin/../games/minetest/mods/xdecor/mailbox.lua:11: in function 'img_col' 2016-05-30 19:20:32: ERROR[Main]: ...t/minetest/bin/../games/minetest/mods/xdecor/mailbox.lua:31: in function 'formspec' 2016-05-30 19:20:32: ERROR[Main]: ...t/minetest/bin/../games/minetest/mods/xdecor/mailbox.lua:85: in function 'on_rightclick' 2016-05-30 19:20:32: ERROR[Main]: /home/minetest/minetest/bin/../builtin/game/item.lua:333: in function </home/minetest/minetest/bin/../builtin/game/item.lua:326>