All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
0.4.1 - 2024-11-19
- The formatting options that were passed as a parameter to
toml.encode
,toml.encodeToFile
,toml.toJSON
, andtoml.toYAML
previously had no effect when overriding values. - Resolved CMake
FetchContent_Populate
warning.
- Updated to magic_enum v0.9.7.
- Added tests for encoding options.
0.4.0 - 2024-01-02
toml.Int
for formatted integers.
local formattedIntegers = {
int1 = toml.Int.new(2582, toml.formatting.int.octal),
int2 = toml.Int.new(3483, toml.formatting.int.binary),
int3 = toml.Int.new(5791, toml.formatting.int.hexadecimal)
}
print(toml.encode(formattedIntegers))
--[[
int1 = 0o5026
int2 = 0b110110011011
int3 = 0x169F
--]]
formattedIntsAsUserdata
can be passed to the options table oftoml.decode
(see "Decoding Options" in the README).- Updated to toml++ v3.4.0.
- Updated to MagicEnum v0.9.5.
- toml.lua compiles with MSVC.
0.3.0 - 2023-02-19
toml.decodeFromFile(filePath: string)
:- Decodes a TOML document at
filePath
. Throws the same errors astoml.decode
.
- Decodes a TOML document at
toml.encodeToFile(data: table, fileOrOptions: string|table)
:- Encodes
data
to the file specified infileOrOptions
. the file will be created if it doesn't exist.- When
fileOrOptions
is a string, it simply is the file path. - When
fileOrOptions
is a table, it should havefile
, and optionally,overwrite
as keys.file
is the file path, andoverwrite
should betrue
whenfile
should be overwritten withdata
, andfalse
whendata
should be appended tofile
.
- When
- Encodes
- Added tests that cover:
- The property accessors of
toml.Date
,toml.Time
,toml.DateTime
, andtoml.TimeOffset
. toml.toJSON
andtoml.toYAML
.
- The property accessors of
toml.tomlToJSON
andtoml.tomlToYAML
have been renamed totoml.toJSON
andtoml.toYAML
.- They have been renamed because they now have two functions: converting a TOML string to JSON/YAML (as before), or converting a table into JSON/YAML.
- The first parameter can be a string containing TOML (as before), or a table.
0.2.0 - 2023-02-12
-
Updated to toml++ v3.3.0
-
Added
terseKeyValuePairs
to the list of formatting options fortoml.encode
-
Tables can be made inline.
-
toml.decode
can decode date, time and date-time into userdata (as before) or plain tables:local tomlStr = [[ date = 1979-05-27 time = 07:32:00 datetime = 1979-05-27T07:32:00-07:00 ]] local table1 = toml.decode(tomlStr, { temporalTypesAsUserData = true }) local table2 = toml.decode(tomlStr, { temporalTypesAsUserData = false }) print(inspect(table1)) --[[ { date = <userdata 1> -- 1979-05-27, time = <userdata 2> -- 07:32:00, datetime = <userdata 3> -- 1979-05-27T07:32:00-07:00 } --]] print(inspect(table2)) --[[ { date = { day = 27, month = 5, year = 1979 }, datetime = { date = { day = 27, month = 5, year = 1979 }, time = { hour = 7, minute = 32, nanoSecond = 0, second = 0 }, timeOffset = { minutes = -420 } }, time = { hour = 7, minute = 32, nanoSecond = 0, second = 0 } } --]]
-
Test suite now runs on Windows
- Boolean values are decoded as booleans instead of integers. (#6)
0.1.1 - 2022-06-14
- Windows support.
0.1.0 - 2022-04-08
- Upgrade to toml++ 3.0.1
- TOML documents can be converted to JSON or YAML.
- Formatting options can be passed to the
encode
,tomlToJSON
, andtomlToYAML
functions.
- Removed
formattedReason
from decoding error messages.
0.0.4 - 2021-11-24
- toml.lua is now tested with
g++
andclang++
with Lua 5.3, 5.2, 5.1 and LuaJIT.
- toml.lua now depends on Lua 5.1, instead of Lua 5.3.
0.0.3 - 2021-11-08
- Date, time, and date-time types.
- Integers are now inserted into TOML documents as integers, not floating-point numbers.
0.0.2 - 2021-10-29
- The
decode
andtomlToJSON
functions now return a table containing error details instead of a string if parsing a TOML document fails.
0.0.1 - 2021-10-27
- Initial Release.