aboutsummaryrefslogtreecommitdiff
path: root/io/init.lua
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2015-06-05 16:56:33 +0800
committerDeterminant <[email protected]>2015-06-05 16:56:33 +0800
commiteba6049a82455499c68ee875843b6f44d6164fa5 (patch)
tree318485b878b80bf1ebfe5bcea4eecf014561f97e /io/init.lua
parentb6b85c02db6a44c17957d7b59cf68494da822a0b (diff)
add close method for ChunkFile, fix #18
Diffstat (limited to 'io/init.lua')
-rw-r--r--io/init.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/io/init.lua b/io/init.lua
index c151804..b722a81 100644
--- a/io/init.lua
+++ b/io/init.lua
@@ -18,6 +18,9 @@ function nerv.ChunkFile:write_chunk(chunk)
end
function nerv.ChunkFile:read_chunk(id, global_conf)
+ if self.metadata == nil then
+ nerv.error("wrong file opening mode")
+ end
local metadata = self.metadata[id]
if metadata == nil then
nerv.error("chunk with id %s does not exist", id)