1
0
Fork 0
mirror of https://github.com/Oreolek/ink-instead.git synced 2024-06-26 03:50:45 +03:00
ink-instead/examples/game.lua
2016-12-10 00:01:22 +01:00

21 lines
596 B
Lua

local pink = require('pink.pink')
-- 1) Load story
local story = pink.getStory('examples/game.ink')
while true do
-- 2) Game content, line by line
while story.canContinue do
print(story.continue())
end
-- 3) Display story.currentChoices list, allow player to choose one
for i = 1, #story.currentChoices do
print(i .. "> " .. story.currentChoices[i].text)
end
if #story.currentChoices == 0 then break end -- cannot continue and there are no choices
local answer=io.read()
print (story.currentChoices[tonumber(answer)].choiceText)
story.chooseChoiceIndex(answer)
end