function draw(dx1,dy1,dx2,dy2,dcol)
for a=dx1,dx2 do
for b=dy1,dy2 do
term.setCursorPos(a,B)/>/>
term.setBackgroundColor(dcol)
term.write(" ")
end
end
end
repeat
input={}
inputnum=0
event={os.pullEvent()}
if event[1]=='char' then
term.write(event[2])
table.insert(input,event[2])
inputnum=inputnum+1
elseif event[1]=='key' and event[2]==14 then
input[i]=nil
inputnum=inputnum-1
ix=inputnum+17
draw(ix,12,ix,12,colors.white)
end
until event[1]=='key' and event[2]==28
Help with a typing program using tables.
Started by axel.codeFail(), Oct 14 2014 07:53 PM
2 replies to this topic
#1
Posted 14 October 2014 - 07:53 PM
I'm trying to make a typing program that will take user input and place it into a table for later use. Everything works fine until I press backspace. I have the backspace placed into the function to remove the last item placed into the table, but I get the error [string "test"]:20: table index is nil.
#2
Posted 14 October 2014 - 08:09 PM
Did you hear that? I just face palmed so hard that it broke the sound barrier.
At line 20 I have
But the variable i is never defined. So never mind, this is solved.
At line 20 I have
input[i]=nil
But the variable i is never defined. So never mind, this is solved.
Edited by axel.codeFail(), 14 October 2014 - 08:10 PM.
#3
Posted 15 October 2014 - 07:01 AM
haha nice!
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











