Golf tostring()
This commit is contained in:
parent
58bf1d70bf
commit
137a390b65
@ -177,19 +177,6 @@ function kbd:release(i)
|
||||
end
|
||||
|
||||
function tostring(any)
|
||||
if type(any)=="function" then
|
||||
return "function"
|
||||
end
|
||||
if any==nil then
|
||||
return "nil"
|
||||
end
|
||||
if type(any)=="string" then
|
||||
return any
|
||||
end
|
||||
if type(any)=="boolean" then
|
||||
if any then return "true" end
|
||||
return "false"
|
||||
end
|
||||
if type(any)=="table" then
|
||||
local str = "{ "
|
||||
for k,v in pairs(any) do
|
||||
@ -197,10 +184,7 @@ function tostring(any)
|
||||
end
|
||||
return str.."}"
|
||||
end
|
||||
if type(any)=="number" then
|
||||
return ""..any
|
||||
end
|
||||
return "unknown" -- should never show
|
||||
return tostr(any)
|
||||
end
|
||||
|
||||
-->8
|
||||
|
Loading…
Reference in New Issue
Block a user