1
0
Fork 0
mirror of https://github.com/Oreolek/ink-instead.git synced 2024-07-08 01:24:39 +03:00

.love file packaging support

This commit is contained in:
premek 2017-01-15 01:50:55 +01:00
parent 0ef5f2227c
commit b9a7c2e73c

View file

@ -3,12 +3,17 @@ local parser = require(folderOfThisFile .. 'parser')
local runtime = require(folderOfThisFile .. 'runtime')
local function read(file)
local function read(file) -- TODO should this be here or in client code? At lease allow to pass an ink content in a string
if love and love.filesystem and love.filesystem.read then
local content, size = love.filesystem.read(file)
return content
else
local f = io.open(file, "rb")
if not f then error('failed to open "'..file..'"') end
local content = f:read("*all")
f:close()
return content
end
end