+local function deserialize_workaround(content)\r
+ local nodes\r
+ if not jit then\r
+ nodes = minetest.deserialize(content)\r
+ else\r
+ -- XXX: This is a filthy hack that works surprisingly well\r
+ -- in LuaJIT, `minetest.deserialize` will fail due to the register limit\r
+ nodes = {}\r
+ content = content:gsub("^%s*return%s*{", "", 1):gsub("}%s*$", "", 1) -- remove the starting and ending values to leave only the node data\r
+ -- remove string contents strings while preserving their length\r
+ local escaped = content:gsub("\\\\", "@@"):gsub("\\\"", "@@"):gsub("(\"[^\"]*\")", function(s) return string.rep("@", #s) end)\r
+ local startpos, startpos1 = 1, 1\r
+ local endpos\r
+ while true do -- go through each individual node entry (except the last)\r
+ startpos, endpos = escaped:find("},%s*{", startpos)\r
+ if not startpos then\r
+ break\r
+ end\r
+ local current = content:sub(startpos1, startpos)\r
+ local entry = minetest.deserialize("return " .. current)\r
+ table.insert(nodes, entry)\r
+ startpos, startpos1 = endpos, endpos\r
+ end\r
+ local entry = minetest.deserialize("return " .. content:sub(startpos1)) -- process the last entry\r
+ table.insert(nodes, entry)\r
+ end\r
+ return nodes\r
+end\r
+\r
+--- Loads the schematic in `value` into a node list in the latest format.\r