28.03.2023, 06:06
Use this conversion function instead of tonumber:
Code:
function tovalue(val)
if type(val) ~= 'string' then
return nil
elseif val == 'active' then
return true
elseif val == 'inactive' then
return false
else
return tonumber(val) or val
end
end