Releases: LebJe/toml.lua
Releases · LebJe/toml.lua
0.4.2
0.4.1
Changelog
Fixed
- The formatting options that were passed as a parameter to
toml.encode,toml.encodeToFile,toml.toJSON, andtoml.toYAMLpreviously had no effect when overriding values. - Resolved CMake
FetchContent_Populatewarning.
Changed
- Updated to magic_enum v0.9.7.
Added
- Added tests for encoding options.
0.4.0
Added
toml.Intfor 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
--]]formattedIntsAsUserdatacan 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
Changelog
Added
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
datato the file specified infileOrOptions. the file will be created if it doesn't exist.- When
fileOrOptionsis a string, it simply is the file path. - When
fileOrOptionsis a table, it should havefile, and optionally,overwriteas keys.fileis the file path, andoverwriteshould betruewhenfileshould beoverwrittenwithdata, andfalsewhendatashould be appended tofile.
- When
- Encodes
- Added tests that cover:
- The property accessors of
toml.Date,toml.Time,toml.DateTime, andtoml.TimeOffset. toml.toJSONandtoml.toYAML.
- The property accessors of
Changed
toml.tomlToJSONandtoml.tomlToYAMLhave been renamed totoml.toJSONandtoml.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
Added
-
Updated to toml++ v3.3.0
-
Added
terseKeyValuePairsto the list of formatting options fortoml.encode -
Tables can be made inline.
-
Test suite now runs on Windows
-
toml.decodecan 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 } } --]]
Changed
Fixed
- Boolean values are decoded as booleans instead of integers. (#6)
Windows Support
Changelog
Added
- Windows support.
0.1.0
Changelog
Added
- Upgrade to toml++ 3.0.1
- TOML documents can be converted to JSON or YAML.
- Formatting options can be passed to the
encode,tomlToJSON, andtomlToYAMLfunctions.
Removed
- Removed
formattedReasonfrom decoding error messages.