local function loadyaml(config)
local posix = require "posix"
local lyaml = require "lyaml"
local s
if posix.stat(config) ~= nil then
local f = io.open(config)
f:close()
return lyaml.load (s)
end
end
x = loadyaml("y.yaml")
for k,v in pairs(x) do
print(type(k),type(v))
print(k,v)
end
The result is
number table
2017.11 table: 0x5620e93dd8a0
string table
2017.11.02 table: 0x5620e93dd8a0
I know that Lua likes to type things as numbers which can be considered to be numbers under certain circumstances, but is this really appropriate behavior here?
If one simply assigns these values, Lua doesn't type them differently.
Actually, it looks like this is expected behavior for YAML, thinking about it further. Python also does basically the same thing (it gives float). There doesn't seem to be a delete option, so closing.
Consider the following YAML file, say
y.yaml
Then consider the following loading code:
The result is
I know that Lua likes to type things as numbers which can be considered to be numbers under certain circumstances, but is this really appropriate behavior here?
If one simply assigns these values, Lua doesn't type them differently.