Posted 27 March 2018 - 09:15 PM
So, I recently got into making CC programs and I am having troubles with this
I am trying to make a string of letters into a single number.
I have done this
Any suggestions?
I am trying to make a string of letters into a single number.
I have done this
local letters = 'abcdefghijklmnopqrstuvwxyz'
local input = read()
local data = 0
for i=1, #input do
local char = input:sub(i,i)
local num = letters:find(char)
local temp = num + data
local data = temp
print(data)
end
but it doesn't work. I have probably made it way too complicated than it has to be :)Any suggestions?