From b9a7c2e73c32c2033fd20ab3ac34f1ec8a34433e Mon Sep 17 00:00:00 2001 From: premek Date: Sun, 15 Jan 2017 01:50:55 +0100 Subject: [PATCH] .love file packaging support --- pink/pink.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pink/pink.lua b/pink/pink.lua index ae80c21..db5e436 100644 --- a/pink/pink.lua +++ b/pink/pink.lua @@ -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