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

String.lower help

Started by MegaShrimp, 13 July 2012 - 08:28 PM
MegaShrimp #1
Posted 13 July 2012 - 10:28 PM
I'm trying to make a commands with write() work however you type them.

Email
email
or even something like EmAiL

But have no clue how to do that. I'm assuming it involves string.lower. but whenever I try that it only works when I type the commands in lowercase.


name = "MacDaddy"
write("What would you like to do a the moment" .. name .. "? :")
Action = io.read()
if Action == string.lower("Email") then
–Blah blah blah
end


Note: this is just a sample to show you what I mean.
MegaShrimp #2
Posted 13 July 2012 - 10:37 PM
D:

I've even tried string.lower(Action) but fro some reason, that wont even let me type them in uppercase. T-T
MysticT #3
Posted 13 July 2012 - 10:39 PM
You have to use string.lower on the input:

if string.lower(Action) == "email" then
Remember to write the string you'r comparing to in lower case, or it will never return true.
MegaShrimp #4
Posted 13 July 2012 - 10:46 PM
Thanks so much. :P/>/>