@@ -159,20 +159,20 @@ local function load_schematic(value)
159
159
else
160
160
-- XXX: This is a filthy hack that works surprisingly well - in LuaJIT, `minetest.deserialize` will fail due to the register limit
161
161
nodes = {}
162
- value = value :gsub (" return%s*{" , " " , 1 ):gsub (" }%s*$" , " " , 1 ) -- remove the starting and ending values to leave only the node data
163
- local escaped = value :gsub (" \\\\ " , " @@" ):gsub (" \\\" " , " @@" ):gsub (" (\" [^\" ]*\" )" , function (s ) return string.rep (" @" , # s ) end )
162
+ content = content :gsub (" return%s*{" , " " , 1 ):gsub (" }%s*$" , " " , 1 ) -- remove the starting and ending values to leave only the node data
163
+ local escaped = content :gsub (" \\\\ " , " @@" ):gsub (" \\\" " , " @@" ):gsub (" (\" [^\" ]*\" )" , function (s ) return string.rep (" @" , # s ) end )
164
164
local startpos , startpos1 , endpos = 1 , 1
165
165
while true do -- go through each individual node entry (except the last)
166
166
startpos , endpos = escaped :find (" },%s*{" , startpos )
167
167
if not startpos then
168
168
break
169
169
end
170
- local current = value :sub (startpos1 , startpos )
170
+ local current = content :sub (startpos1 , startpos )
171
171
local entry = minetest .deserialize (" return " .. current )
172
172
table.insert (nodes , entry )
173
173
startpos , startpos1 = endpos , endpos
174
174
end
175
- local entry = minetest .deserialize (" return " .. value :sub (startpos1 )) -- process the last entry
175
+ local entry = minetest .deserialize (" return " .. content :sub (startpos1 )) -- process the last entry
176
176
table.insert (nodes , entry )
177
177
end
178
178
else
0 commit comments