Posted 04 August 2012 - 10:31 PM
Hey Pro's.
Im new to Lua coding (found out about it last night) and am trying to write a basic code to open a door with Key Press'.
So far i've gotten it to say [Press [O] to open] or [Press [C] to Close]
But when I press the keys nothing happens.
Could you take a look and tell me how its wrong or any ways to improve it?
thanks :P/>/>
My code so far:
Im new to Lua coding (found out about it last night) and am trying to write a basic code to open a door with Key Press'.
So far i've gotten it to say [Press [O] to open] or [Press [C] to Close]
But when I press the keys nothing happens.
Could you take a look and tell me how its wrong or any ways to improve it?
thanks :P/>/>
My code so far:
print("What do you want do do?")
print("[Press [O] to Open] or [Press [C] to Close]")
while true do
event, pl = os.pullEvent(38)
end
if pl == 24 then
rs.setOutput(left,true)
print("Door Opened")
sleep(1)
end
if pl == 46 then
rs.setOutput(left,false)
print("Door Closed")
sleep(1)
end