spaces to tabs

This commit is contained in:
Pinya
2017-12-14 20:54:23 +03:00
parent 5ec03ea8f5
commit 79042cdbbb
+39 -39
View File
@@ -44,25 +44,25 @@ end
function math.modf(i) function math.modf(i)
assert(type(i) == "number", format("bad argument #1 to 'modf' (number expected, got %s)", i and type(i) or "no value")) assert(type(i) == "number", format("bad argument #1 to 'modf' (number expected, got %s)", i and type(i) or "no value"))
local int = i >= 0 and floor(i) or ceil(i) local int = i >= 0 and floor(i) or ceil(i)
return int, i - int return int, i - int
end end
function string.join(delimiter, ...) function string.join(delimiter, ...)
assert(type(delimiter) == "string" or type(delimiter) == "number", format("bad argument #1 to 'join' (string expected, got %s)", delimiter and type(delimiter) or "no value")) assert(type(delimiter) == "string" or type(delimiter) == "number", format("bad argument #1 to 'join' (string expected, got %s)", delimiter and type(delimiter) or "no value"))
local size = getn(arg) local size = getn(arg)
if size == 0 then if size == 0 then
return "" return ""
end end
local text = arg[1] local text = arg[1]
for i = 2, size do for i = 2, size do
text = text..delimiter..arg[i] text = text..delimiter..arg[i]
end end
return text return text
end end
strjoin = string.join strjoin = string.join
@@ -139,36 +139,36 @@ wipe = table.wipe
local LOCAL_ToStringAllTemp = {} local LOCAL_ToStringAllTemp = {}
function tostringall(...) function tostringall(...)
local n = getn(arg) local n = getn(arg)
-- Simple versions for common argument counts -- Simple versions for common argument counts
if (n == 1) then if (n == 1) then
return tostring(arg[1]) return tostring(arg[1])
elseif (n == 2) then elseif (n == 2) then
return tostring(arg[1]), tostring(arg[2]) return tostring(arg[1]), tostring(arg[2])
elseif (n == 3) then elseif (n == 3) then
return tostring(arg[1]), tostring(arg[2]), tostring(arg[3]) return tostring(arg[1]), tostring(arg[2]), tostring(arg[3])
elseif (n == 0) then elseif (n == 0) then
return return
end end
local needfix local needfix
for i = 1, n do for i = 1, n do
local v = arg[i] local v = arg[i]
if (type(v) ~= "string") then if (type(v) ~= "string") then
needfix = i needfix = i
break break
end end
end end
if (not needfix) then return unpack(arg) end if (not needfix) then return unpack(arg) end
wipe(LOCAL_ToStringAllTemp) wipe(LOCAL_ToStringAllTemp)
for i = 1, needfix - 1 do for i = 1, needfix - 1 do
LOCAL_ToStringAllTemp[i] = arg[i] LOCAL_ToStringAllTemp[i] = arg[i]
end end
for i = needfix, n do for i = needfix, n do
LOCAL_ToStringAllTemp[i] = tostring(arg[i]) LOCAL_ToStringAllTemp[i] = tostring(arg[i])
end end
return unpack(LOCAL_ToStringAllTemp) return unpack(LOCAL_ToStringAllTemp)
end end
local LOCAL_PrintHandler = function(...) local LOCAL_PrintHandler = function(...)