From 6c1e726fa0ae04c8eda49667b82ba89a1f2c349f Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Tue, 2 Aug 2011 17:56:09 -0700 Subject: [PATCH] whitespace --- lib/stdlib/ext/table.lua | 44 ++++++++++++++++----------------- lib/stdlib/helpers/autoload.lua | 2 +- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/lib/stdlib/ext/table.lua b/lib/stdlib/ext/table.lua index c6bc32d..3101521 100644 --- a/lib/stdlib/ext/table.lua +++ b/lib/stdlib/ext/table.lua @@ -1,10 +1,10 @@ function table.clone(t, nometa) local u = {} - + if not nometa then setmetatable(u, getmetatable(t)) end - + for i, v in pairs(t) do if type(v) == "table" then u[i] = table.clone(v) @@ -12,17 +12,17 @@ function table.clone(t, nometa) u[i] = v end end - + return u end function table.merge(t, u) local r = table.clone(t) - + for i, v in pairs(u) do r[i] = v end - + return r end @@ -42,8 +42,8 @@ function table.unique(t) end function table.values(t) - local values = {} - for k, v in pairs(t) do table.insert(values, v) end + local values = {} + for k, v in pairs(t) do table.insert(values, v) end return values end @@ -55,7 +55,7 @@ function table.append(t, moreValues) for i, v in ipairs(moreValues) do table.insert(t, v) end - + return t end @@ -67,7 +67,7 @@ function table.indexOf(t, value) if v == value then return k end end end - + return nil end @@ -83,15 +83,15 @@ end function table.each(t, func) for k, v in pairs(t) do - func(v) - end + func(v, k) + end end function table.find(t, func) for k, v in pairs(t) do if func(v) then return v, k end end - + return nil end @@ -100,7 +100,7 @@ function table.filter(t, func) for k, v in pairs(t) do if func(v) then table.insert(matches, v) end end - + return matches end @@ -109,7 +109,7 @@ function table.map(t, func) for k, v in pairs(t) do table.insert(mapped, func(v, k)) end - + return mapped end @@ -117,10 +117,10 @@ function table.groupBy(t, func) local grouped = {} for k, v in pairs(t) do local groupKey = func(v) - if not grouped[groupKey] then grouped[groupKey] = {} end + if not grouped[groupKey] then grouped[groupKey] = {} end table.insert(grouped[groupKey], v) end - + return grouped end @@ -139,27 +139,27 @@ function table.tostring(tbl, indent, limit, depth, jstack) end end table.insert(jstack, tbl) - + table.insert(output, "{\n") for key, value in pairs(tbl) do local innerIndent = (indent or " ") .. (indent or " ") table.insert(output, innerIndent .. tostring(key) .. " = ") - table.insert(output, + table.insert(output, value == tbl and "," or table.tostring(value, innerIndent, limit, depth, jstack) ) - + i = i + 1 if i > limit then table.insert(output, (innerIndent or "") .. "...\n") break end end - + table.insert(output, indent and (indent or "") .. "},\n" or "}") else - if type(tbl) == "string" then tbl = string.format("%q", tbl) end -- quote strings + if type(tbl) == "string" then tbl = string.format("%q", tbl) end -- quote strings table.insert(output, tostring(tbl) .. ",\n") end - + return table.concat(output) end \ No newline at end of file diff --git a/lib/stdlib/helpers/autoload.lua b/lib/stdlib/helpers/autoload.lua index 5871531..5085552 100644 --- a/lib/stdlib/helpers/autoload.lua +++ b/lib/stdlib/helpers/autoload.lua @@ -2,7 +2,7 @@ function wax.autoload(...) for i, folder in ipairs({...}) do local files = wax.filesystem.search(wax.root(folder), "lua$") for i, file in ipairs(files) do - local requireString = file:match(wax.root() .. "/(.*)%.lua$") + local requireString = file:match(wax.root() .. "/(.*)%.lua$") requireString = requireString:gsub("/", ".") require(requireString) end