]> git.lizzy.rs Git - xdecor.git/blobdiff - handlers/helpers.lua
Global code style cleaning
[xdecor.git] / handlers / helpers.lua
index cbb9113e1fe97726903ecb5c3735b5d9251df17e..c80d9aee1ae62cbbc6577e972ec96820b80c1a55 100644 (file)
@@ -2,21 +2,31 @@
 function xdecor.maxn(T)
        local n = 0
        for k in pairs(T) do
-               if k > n then n = k end
+               if k > n then
+                       n = k
+               end
        end
+
        return n
 end
 
 -- Returns the length of an hash table.
 function xdecor.tablelen(T)
        local n = 0
-       for _ in pairs(T) do n = n + 1 end
+
+       for _ in pairs(T) do
+               n = n + 1
+       end
+
        return n
 end
 
 -- Deep copy of a table. Borrowed from mesecons mod (https://github.com/Jeija/minetest-mod-mesecons).
 function xdecor.tablecopy(T)
-       if type(T) ~= "table" then return T end -- No need to copy.
+       if type(T) ~= "table" then
+               return T -- No need to copy.
+       end
+
        local new = {}
 
        for k, v in pairs(T) do
@@ -26,6 +36,7 @@ function xdecor.tablecopy(T)
                        new[k] = v
                end
        end
+
        return new
 end