Skip to content

Instantly share code, notes, and snippets.

@tunglam14
Created May 13, 2015 02:50
Show Gist options
  • Save tunglam14/72b6e70bac9f462ee5d5 to your computer and use it in GitHub Desktop.
Save tunglam14/72b6e70bac9f462ee5d5 to your computer and use it in GitHub Desktop.
-- Lua 5.3
-- http://www.familug.org/2015/05/golang-tinh-tu-cung-9gag.html#more
function sum(str)
_s = 0
for i = 1, string.len(str) do
_s = _s + str:lower():byte(i) - string.byte('a') + 1
end
return _s
end
io.write(sum('Attitude'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment