Code: Select all
function love.keypressed(k)
if k=='1' then
require"story1"
end
end
Code: Select all
function love.load()
q=''
w=''
e=''
r=''
t=''
y=''
z='1'
end
function love.update(dt)
end
function love.keypressed(k)
if k=='x' and z=='1' then
q='Why hello there'
elseif k=='x' and z=='2' then
w='You wake up in a dark, muddy hole. What do you do?! A: Get out B: Die'
elseif k=='a' and z=='3' then
e='You climbed out! Now what do you do? A:Search for food B:Search for civilization'
elseif k=='b' and z=='3' then
e='Wow.'
elseif k=='a' and z=='4' then
r='You stumble upon a big sign that says "Good job! You looked at the Early Version!"'
elseif k=='b' and z=='4' then
r='You stumble upon a big sign that says "Good job! You looked at the Early Version!"'
end
end
function love.keyreleased(k)
if k=='x' and z=='1' then
z='2'
elseif k=='x' and z=='2' then
z='3'
elseif k=='a' and z=='3' then
z='4'
elseif k=='b' and z=='3' then
love.event.push('q')
else if k== 'a' or 'b' and z=='4' then
love.event.push('q')
end
end
end
function love.draw()
love.graphics.print('Press x',0,0)
love.graphics.print(q,0,10)
love.graphics.print(w,0,20)
love.graphics.print(e,0,30)
love.graphics.print(r,0,40)
love.graphics.print(t,0,50)
love.graphics.print(y,0,60)
end
Error
story1.lua:45 bad argument #1 to 'print' (string expected, got nil)
Traceback
[C]: in function 'print'
story1.lua:45: in function 'draw'
[C]: in function 'xpcall'