Skip to content

Instantly share code, notes, and snippets.

@nefftd
Created October 16, 2014 22:18
Show Gist options
  • Save nefftd/6ddaa23b27e84f73fa6e to your computer and use it in GitHub Desktop.
Save nefftd/6ddaa23b27e84f73fa6e to your computer and use it in GitHub Desktop.
-- String functions
local tsa_r -- recursion TSA
local tsa_a -- array-based TSA
do
local function _tsa(n,a,...)
if n > 0 then
return tostring(a),_tsa(n-1,...)
end
end
function tostringall(...)
local n = select('#',...)
if n > 0 then
return _tsa(n,...)
end
end
tsa_r = tostringall
end
do
-- Alternate tostringall
function tostringall(...)
local n = select('#',...)
local s = {...}
for i = 1,n do
s[i] = tostring(s[i])
end
return unpack(s,1,n)
end
tsa_a = tostringall
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment