]> git.lizzy.rs Git - xdecor.git/blobdiff - worktable.lua
Add some helpers (just in case)
[xdecor.git] / worktable.lua
index a596fe108231c3c3f6855bd5191fc8507fe6ab6f..cd486ee3ccfcb5de9ad0255579648077e00f4285 100644 (file)
@@ -106,7 +106,7 @@ function worktable:craftguide_formspec(meta, pagenum, item, recipe_num, filter)
                local items = minetest.get_all_craft_recipes(item)[recipe_num].items
                local width = minetest.get_all_craft_recipes(item)[recipe_num].width
                if width == 0 then width = math.min(3, #items) end
-               local rows = math.ceil(table.maxn(items) / width)
+               local rows = math.ceil(table.maxn(items) / width) -- Lua 5.3 removed `table.maxn`, use `xdecor.maxn` in case of failure.
 
                local function is_group(item)
                        if item:find("^group:") then return "G" end
@@ -369,7 +369,7 @@ for node in pairs(minetest.registered_nodes) do
                        sounds = def.sounds,
                        tiles = tiles,
                        groups = groups,
-                       node_box = xdecor.pixelnodebox(16, {unpack(d, 3)}),
+                       node_box = xdecor.pixelbox(16, {unpack(d, 3)}), -- `unpack` has been changed to `table.unpack` in newest Lua versions.
                        sunlight_propagates = true,
                        on_place = minetest.rotate_node,
                        on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)