Skip to content

Boolean values get decoded as integers rather than as booleans #6

Closed
@ghost

Description

local tomlStr = [[
a = 1275892
b = 'Hello, World!'
c = true
d = 124.2548

[e]
f = [ 1, 2, 3, '4', 5.142 ]
g = 1979-05-27
h = 07:32:00
i = 1979-05-27T07:32:00-07:00
]]

local succeeded, decoded_toml = pcall(toml.decode, tomlStr)

assert(decoded_toml.c == 1) -- succeeds (but shouldn't)
assert(decoded_toml.c == true) -- fails (but should succeed)

Install log:

❯ luarocks install toml
Installing https://luarocks.org/toml-0.1.1-0.src.rock

toml 0.1.1-0 depends on lua >= 5.1 (5.4-1 provided by VM)
Warning: unmatched variable LINK_FLAGS
Warning: unmatched variable LUA_LIBRARIES
-- The C compiler identification is AppleClang 13.1.6.13160021
-- The CXX compiler identification is AppleClang 13.1.6.13160021
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Cloning toml++
-- Cloning sol2
-- Cloning magic_enum
-- Performing Test COMPILER_SUPPORTS_ARCH_NATIVE
-- Performing Test COMPILER_SUPPORTS_ARCH_NATIVE - Failed
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/sam/.tmp/luarocks_toml-0.1.1-0-4410119/toml.lua/build.luarocks
[ 16%] Building CXX object CMakeFiles/toml.lua.dir/src/toml.cpp.o
[ 33%] Building CXX object CMakeFiles/toml.lua.dir/src/decoding/decoding.cpp.o
[ 50%] Building CXX object CMakeFiles/toml.lua.dir/src/encoding/encoding.cpp.o
[ 66%] Building CXX object CMakeFiles/toml.lua.dir/src/DateAndTime/dateAndTime.cpp.o
[ 83%] Building CXX object CMakeFiles/toml.lua.dir/src/utilities/utilities.cpp.o
[100%] Linking CXX shared module toml.so
[100%] Built target toml.lua
[100%] Built target toml.lua
Install the project...
-- Install configuration: "Release"
-- Installing: /opt/homebrew/lib/luarocks/rocks-5.4/toml/0.1.1-0/lib/toml.so
toml 0.1.1-0 is now installed in /opt/homebrew (license: MIT)

Lua 5.4, macOS 12.4, using via Hammerspoon.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions