This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Azhf's profile picture

How can I detect user text input?

Started by Azhf, 20 April 2013 - 05:09 PM
Azhf #1
Posted 20 April 2013 - 07:09 PM
So I am working on YouFindYourselfInARoom(a game on newgrounds) in CC, and I need to know how to detect certain text inputs written by the user such as "Look". Is this possible? If not, then I can believe I won't be able to make YFYIAR on CC :(/>
BigSHinyToys #2
Posted 20 April 2013 - 07:13 PM
local test = "bla"
local input = read()
if test == input then
print("same")
else
print("diffrent")
end
theoriginalbit #3
Posted 20 April 2013 - 07:18 PM
string.find will solve your problems.


local input = string.lower(read())
if input:find('look') then
  -- the input they have typed contains look
end
Azhf #4
Posted 20 April 2013 - 09:08 PM
Thanks guys. :)/>