AspectedRouting/AspectedRouting/IO/lua/parse.lua

27 lines
471 B
Lua
Raw Normal View History

2020-04-30 17:23:44 +02:00
function parse(string)
if (string == nil) then
return 0
end
if (type(string) == "number") then
return string
end
if (string == "yes" or string == "true") then
return 1
end
if (string == "no" or string == "false") then
return 0
end
if (type(string) == "boolean") then
if (string) then
return 1
else
return 0
end
end
return tonumber(string)
end