add dialog
This commit is contained in:
parent
c92c0f6ff7
commit
5413823b26
13 changed files with 390 additions and 32 deletions
31
tools/compile_ink.lua
Normal file
31
tools/compile_ink.lua
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
-- Compile Ink source (stories/*.ink) into the pre-parsed .lua books the game
|
||||
-- loads. LÖVE ships no lpeg, so parsing happens here, once, at author time;
|
||||
-- the game only ever requires the compiled .lua. Needs a standalone `lua` with
|
||||
-- lpeg installed (Arch: pacman -S lua-lpeg).
|
||||
--
|
||||
-- Run from the project root:
|
||||
-- lua tools/compile_ink.lua # compile every stories/*.ink
|
||||
-- lua tools/compile_ink.lua start_sign # compile stories/start_sign.ink
|
||||
-- lua tools/compile_ink.lua stories/foo.ink # explicit path
|
||||
|
||||
package.path = package.path .. ";libs/narrator/?.lua"
|
||||
local narrator = require("narrator.narrator")
|
||||
|
||||
local function compile(path)
|
||||
narrator.parse_file(path, { save = true })
|
||||
print("compiled " .. path .. " -> " .. (path:gsub("%.ink$", "") .. ".lua"))
|
||||
end
|
||||
|
||||
local targets = {}
|
||||
if #arg == 0 then
|
||||
local ls = io.popen("ls stories/*.ink 2>/dev/null")
|
||||
for line in ls:lines() do table.insert(targets, line) end
|
||||
ls:close()
|
||||
else
|
||||
for _, a in ipairs(arg) do
|
||||
table.insert(targets, a:match("%.ink$") and a or ("stories/" .. a .. ".ink"))
|
||||
end
|
||||
end
|
||||
|
||||
assert(#targets > 0, "no .ink files to compile")
|
||||
for _, t in ipairs(targets) do compile(t) end
|
||||
Loading…
Add table
Add a link
Reference in a new issue