Here is what I have written:
local ev = os.pullEvent("key")
repeat
nameCheck()
print("Searching...")
until ev == "key"
How do I make the program quit as soon as a key is pressed, but still run normally until then?
EDIT: The rest of the code.
os.loadAPI("ocs/apis/sensor")
local prox = sensor.wrap("top")
local name = ""
function nameCheck()
local targets = prox.getTargets()
for k,v in pairs(targets) do
if ((v.Name) == "Player") then
details = prox.getTargetDetails(k)
if not(details == nil) then
player_name = details.Username
print(player_name.." has entered the radius")
end
end
end
return player_name
end
local ev = os.pullEvent("key")
repeat
nameCheck()
print("Searching")
until ev == "key"
Edited by alexdr5398, 19 August 2014 - 06:03 PM.












