AspectedRouting/AspectedRouting/IO/lua/parse.lua
Pieter Vander Vennet 2c2a28d30a Initial commit
2020-04-30 17:23:44 +02:00

27 lines
No EOL
471 B
Lua

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