Skip to content

Instantly share code, notes, and snippets.

local CRAFT_TABLE_SIZE = 4
local update_craft_table_inv = function(inv)
inv:set_stack("craftpreview", 1, minetest.get_craft_result({method = "normal", items = inv:get_list("craft"), width = CRAFT_TABLE_SIZE}).item)
end
local update_craft_table = function(pos)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
update_craft_table_inv(inv)
local achievements_file=minetest.get_worldpath() .. "/achievements"
function read_file(filename)
local f = io.open(filename, "r")
if f==nil then return {} end
local t = f:read("*all")
f:close()
if t=="" or t==nil then return {} end
return minetest.deserialize(t)
end
local achievements_file=minetest.get_worldpath() .. "/achievements"
function read_file(filename)
local f = io.open(filename, "r")
if f==nil then return {} end
local t = f:read("*all")
f:close()
if t=="" or t==nil then return {} end
return minetest.deserialize(t)
end