Add minetest.deserialize error reporting (failed config parsing)

This commit is contained in:
Dorian Wouters 2016-08-19 17:32:12 +02:00
parent 84fff7e863
commit cd784a5842
No known key found for this signature in database
GPG Key ID: 6E9DA8063322434B
1 changed files with 4 additions and 1 deletions

View File

@ -78,8 +78,11 @@ do
if not file then
error(modname .. ' failed to load specified config file at ' .. cfgfile)
end
local cfg = minetest.deserialize(file:read('*a'))
local cfg, msg = minetest.deserialize(file:read('*a'))
file:close()
if not cfg then
error(modname .. ' failed to parse specified config file at ' .. cfgfile .. ': ' .. msg)
end
get = function (name)
if type(name) ~= 'string' or name == '' then
return nil