18 lines
477 B
Plaintext
18 lines
477 B
Plaintext
learn_keychord_press = function(chord, key)
|
|
if chord == 'return' then
|
|
if Answer_idx > #Words then
|
|
-- no words yet; do nothing
|
|
elseif trim(Workbook.lines[1].data) == trim(Words[Answer_idx].contents) then
|
|
print('correct!')
|
|
Workbook.lines[1].data = ''
|
|
Workbook.cursor1 = {line=1, pos=1}
|
|
Text.redraw_all(Workbook)
|
|
Answer_idx = love.math.random(#Words)
|
|
play(Answer_idx)
|
|
else
|
|
print(':(')
|
|
end
|
|
else
|
|
edit.keychord_press(Workbook, chord, key)
|
|
end
|
|
end |