Releases: LebJe/toml.lua
Releases · LebJe/toml.lua
0.4.0
Added
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
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
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 beoverwritten
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
Changed
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
Added
-
Updated to toml++ v3.3.0
-
Added
terseKeyValuePairs
to the list of formatting options fortoml.encode
-
Tables can be made inline.
-
Test suite now runs on Windows
-
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 } } --]]
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
, andtomlToYAML
functions.
Removed
- Removed
formattedReason
from decoding error messages.