AndreSoYeah

Untitled

May 23rd, 2015
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.19 KB | None | 0 0
  1. function dectobin(x) -- only works with integers
  2. local r = ""
  3. for i = 0, 7 do
  4. r = (x % 2^i) .. r
  5. x = x - (x % 2^i) -- dunno if this is necessary, but i think it is
  6. end
  7. return tonumber(r)
  8. end
Advertisement
Add Comment
Please, Sign In to add comment