mirror of
https://github.com/gvx/bitser.git
synced 2024-11-24 06:54:20 +00:00
Add assertions for dumpLoveFile and loadLoveFile (#11)
This will print useful error messages instead of just failing silently. E.g.: `lib/Bitser.lua:370: Could not open file prabs/test.lua. Does not exist.`
This commit is contained in:
parent
dd3034117f
commit
4f2680317c
@ -364,9 +364,10 @@ return {dumps = function(value)
|
||||
return ffi.string(buf, buf_pos)
|
||||
end, dumpLoveFile = function(fname, value)
|
||||
serialize(value)
|
||||
love.filesystem.write(fname, ffi.string(buf, buf_pos))
|
||||
assert(love.filesystem.write(fname, ffi.string(buf, buf_pos)))
|
||||
end, loadLoveFile = function(fname)
|
||||
local serializedData = love.filesystem.newFileData(fname)
|
||||
local serializedData, error = love.filesystem.newFileData(fname)
|
||||
assert(serializedData, error)
|
||||
Buffer_newDataReader(serializedData:getPointer(), serializedData:getSize())
|
||||
return deserialize_value({})
|
||||
end, loadData = function(data, size)
|
||||
|
Loading…
Reference in New Issue
Block a user