Updated TOML lib to 2.0.1

This commit is contained in:
Timo Smit 2019-01-04 17:18:39 +01:00
parent b98bccbba6
commit c7009e91d3

View file

@ -1,38 +1,27 @@
-- TOML in Lua by Jonathan Stoler -- TOML in Lua by Jonathan Stoler
-- https://github.com/jonstoler/lua-toml -- https://github.com/jonstoler/lua-toml
-- SUMMARY (IN PLAIN-ENGLISH) -- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
-- Congratulations, you've got something with the best licence ever. -- The above copyright notice and this permission notice shall be included in
-- all copies or substantial portions of the Software.
-- Basically, you're free to do what you want with it; as long as you do something -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- good (help someone out, smile; just be nice), you can use this on anything you -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- fancy. -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- Of course, if it all breaks, its totally not the author's fault. -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- Enjoy! -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-- SOFTWARE.
-- THE FULL LICENSE AGREEMENT
-- By attaching this document to the given files (the "work"), you, the licensee,
-- are hereby granted free usage in both personal and commercial environments,
-- without any obligation of attribution or payment (monetary or otherwise). The
-- licensee is free to use, copy, modify, publish, distribute, sublicence, and/or
-- merchandise the work, subject to the licensee inflecting a positive message
-- unto someone. This includes (but is not limited to): smiling, being nice,
-- saying "thank you", assisting other persons, or any similar actions percolating
-- the given concept.
-- The above copyright notice serves as a permissions notice also, and may
-- optionally be included in copies or portions of the work.
-- The work is provided "as is", without warranty or support, express or implied.
-- The author(s) are not liable for any damages, misuse, or other claim, whether
-- from or as a consequence of usage of the given work.
local TOML = { local TOML = {
-- denotes the current supported TOML version -- denotes the current supported TOML version
version = 0.31, version = 0.40,
-- sets whether the parser should follow the TOML spec strictly -- sets whether the parser should follow the TOML spec strictly
-- currently, no errors are thrown for the following rules if strictness is turned off: -- currently, no errors are thrown for the following rules if strictness is turned off:
@ -53,8 +42,8 @@ TOML.parse = function(toml, options)
-- the official TOML definition of newline -- the official TOML definition of newline
local nl = "[\10" local nl = "[\10"
do do
local crlf = {string.char(224), string.char(180), string.char(138)} local crlf = "\13\10"
nl = nl .. table.concat(crlf) nl = nl .. crlf
end end
nl = nl .. "]" nl = nl .. "]"
@ -651,7 +640,7 @@ TOML.encode = function(tbl)
else else
-- plain ol boring array -- plain ol boring array
toml = toml .. k .. " = [\n" toml = toml .. k .. " = [\n"
for kk, vv in pairs(v) do for kk, vv in pairs(first) do
toml = toml .. tostring(vv) .. ",\n" toml = toml .. tostring(vv) .. ",\n"
end end
toml = toml .. "]\n" toml = toml .. "]\n"
@ -674,4 +663,3 @@ TOML.encode = function(tbl)
end end
return TOML return TOML