Coding style updates.

This commit is contained in:
Uberi 2014-07-12 16:35:59 -04:00
parent 420655bd94
commit 58d7a7134e
1 changed files with 20 additions and 23 deletions

View File

@ -25,11 +25,8 @@ end
--sets a region defined by positions `pos1` and `pos2` to `nodename`, returning the number of nodes filled
worldedit.set = function(pos1, pos2, nodenames)
local oneNode
if type(nodenames) == 'string' then
oneNode = true
else
oneNode = false
if type(nodenames) == "string" then
nodenames = {nodenames}
end
local pos1, pos2 = worldedit.sort_pos(pos1, pos2)
@ -51,7 +48,7 @@ worldedit.set = function(pos1, pos2, nodenames)
for i,v in ipairs(nodenames) do
node_ids[i] = minetest.get_content_id(nodenames[i])
end
if oneNode then --only one type of node
if #node_ids then --only one type of node
local id = node_ids
for i in area:iterp(pos1, pos2) do nodes[i] = id end --fill area with node
else --several types of nodes specified