diff options
Diffstat (limited to 'util.lua')
-rw-r--r-- | util.lua | 22 |
1 files changed, 11 insertions, 11 deletions
@@ -1,13 +1,13 @@ -function digilines:addPosRule(p, r) +function digilines.addPosRule(p, r) return {x = p.x + r.x, y = p.y + r.y, z = p.z + r.z} end -function digilines:cmpPos(p1, p2) +function digilines.cmpPos(p1, p2) return (p1.x == p2.x and p1.y == p2.y and p1.z == p2.z) end --Rules rotation Functions: -function digilines:rotate_rules_right(rules) +function digilines.rotate_rules_right(rules) local nr={} for i, rule in ipairs(rules) do nr[i]={} @@ -18,7 +18,7 @@ function digilines:rotate_rules_right(rules) return nr end -function digilines:rotate_rules_left(rules) +function digilines.rotate_rules_left(rules) local nr={} for i, rule in ipairs(rules) do nr[i]={} @@ -29,7 +29,7 @@ function digilines:rotate_rules_left(rules) return nr end -function digilines:rotate_rules_down(rules) +function digilines.rotate_rules_down(rules) local nr={} for i, rule in ipairs(rules) do nr[i]={} @@ -40,7 +40,7 @@ function digilines:rotate_rules_down(rules) return nr end -function digilines:rotate_rules_up(rules) +function digilines.rotate_rules_up(rules) local nr={} for i, rule in ipairs(rules) do nr[i]={} @@ -51,13 +51,13 @@ function digilines:rotate_rules_up(rules) return nr end -function digilines:tablecopy(table) -- deep table copy +function digilines.tablecopy(table) -- deep table copy if type(table) ~= "table" then return table end -- no need to copy local newtable = {} for idx, item in pairs(table) do if type(item) == "table" then - newtable[idx] = digilines:tablecopy(item) + newtable[idx] = digilines.tablecopy(item) else newtable[idx] = item end @@ -88,12 +88,12 @@ local vm_cache = nil -- directly on VM-loaded arrays, which should be faster for reading many nodes -- in rapid succession. However, the cache must be flushed with vm_end once the -- scan is finished, to avoid using stale data in future. -function digiline:vm_begin() +function digilines.vm_begin() vm_cache = {} end -- Ends a bulk-VoxelManipulator operation, freeing the cached data. -function digiline:vm_end() +function digilines.vm_end() vm_cache = nil end @@ -141,7 +141,7 @@ end -- there. -- -- Inside a bulk-VoxelManipulator operation, the operation’s VM cache is used. -function digiline:get_node_force(pos) +function digilines.get_node_force(pos) if vm_cache then return vm_get_node(pos) end |