I have a configuration script where the user can enter values either as an absolute value or a percentage value.
Absolute values are written as a value between 0.0 and 1.0 while percentage value are written as 0 to 100.
How can I distinguish 1 from 1.0? If I were to use strings, then it's not a problem for sure... I would like to keep this configuration simple and not have to rely strings.
Is this possible at all?
RECAP:
a = 1
b = 1.0
How to tell that a
is not of the same type as b
.
EDIT The configuration file look something like this:
local config = {}
-- A lot of comments describing how to configure
config.paramA = 1
config.paramB = 1.0
return config
In my processing script i read the configs like this:
config = require 'MyConfigFile'
config.paramA
config.paramB