kamilosxd678

[MC-CC] atoi

Aug 28th, 2012
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.22 KB | None | 0 0
  1. function atoi(text)
  2.  output = 0
  3.  for i = 0, string.len(text)-1 do
  4.   power = math.pow(10, string.len(text)-1-i)
  5.   actualNumber = string.byte(text,i+1)-48
  6.   output = output + actualNumber*power
  7.  end
  8.  return output
  9. end
Advertisement
Add Comment
Please, Sign In to add comment