mirror of
https://github.com/Uberi/Minetest-WorldEdit.git
synced 2025-07-16 14:50:22 +02:00
Compare commits
2 Commits
c8afa95542
...
abc9efeeb8
Author | SHA1 | Date | |
---|---|---|---|
abc9efeeb8 | |||
c223ca4cec |
@ -23,7 +23,7 @@ There is a nice installation guide over at the [Minetest Wiki](http://wiki.minet
|
|||||||
8. You should have a mod selection screen. Select the one named something like `Minetest-WorldEdit` by left clicking once and press the **Enable Modpack** button.
|
8. You should have a mod selection screen. Select the one named something like `Minetest-WorldEdit` by left clicking once and press the **Enable Modpack** button.
|
||||||
9. Press the **Save** button. You can now use WorldEdit in that world. Repeat steps 7 to 9 to enable WorldEdit for other worlds too.
|
9. Press the **Save** button. You can now use WorldEdit in that world. Repeat steps 7 to 9 to enable WorldEdit for other worlds too.
|
||||||
|
|
||||||
If you are having trouble, try asking for help in the [IRC channel](https://webchat.freenode.net/?channels=#minetest) (faster but may not always have helpers online)
|
If you are having trouble, try asking for help in the [IRC channel](https://web.libera.chat/#minetest) (faster but may not always have helpers online)
|
||||||
or ask on the [forum topic](https://forum.minetest.net/viewtopic.php?id=572) (slower but more likely to get help).
|
or ask on the [forum topic](https://forum.minetest.net/viewtopic.php?id=572) (slower but more likely to get help).
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
|
@ -114,12 +114,15 @@ function worldedit.serialize(pos1, pos2)
|
|||||||
return LATEST_SERIALIZATION_HEADER .. result, count
|
return LATEST_SERIALIZATION_HEADER .. result, count
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Contains code based on [table.save/table.load](http://lua-users.org/wiki/SaveTableToFile)
|
|
||||||
-- by ChillCode, available under the MIT license.
|
|
||||||
local function deserialize_workaround(content)
|
local function deserialize_workaround(content)
|
||||||
local nodes
|
local nodes
|
||||||
if not minetest.global_exists("jit") then
|
if not minetest.global_exists("jit") then
|
||||||
nodes = minetest.deserialize(content, true)
|
nodes = minetest.deserialize(content, true)
|
||||||
|
elseif not content:match("^%s*return%s*{") then
|
||||||
|
-- The data doesn't look like we expect it to so we can't apply the workaround.
|
||||||
|
-- hope for the best
|
||||||
|
minetest.log("warning", "WorldEdit: deserializing data but can't apply LuaJIT workaround")
|
||||||
|
nodes = minetest.deserialize(content, true)
|
||||||
else
|
else
|
||||||
-- XXX: This is a filthy hack that works surprisingly well
|
-- XXX: This is a filthy hack that works surprisingly well
|
||||||
-- in LuaJIT, `minetest.deserialize` will fail due to the register limit
|
-- in LuaJIT, `minetest.deserialize` will fail due to the register limit
|
||||||
@ -130,7 +133,7 @@ local function deserialize_workaround(content)
|
|||||||
local startpos, startpos1 = 1, 1
|
local startpos, startpos1 = 1, 1
|
||||||
local endpos
|
local endpos
|
||||||
while true do -- go through each individual node entry (except the last)
|
while true do -- go through each individual node entry (except the last)
|
||||||
startpos, endpos = escaped:find("},%s*{", startpos)
|
startpos, endpos = escaped:find("}%s*,%s*{", startpos)
|
||||||
if not startpos then
|
if not startpos then
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user