Skip to content

Instantly share code, notes, and snippets.

@lexnewgate
Created July 29, 2016 07:45
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save lexnewgate/28663fecae78324a87f38aa9c2e0a293 to your computer and use it in GitHub Desktop.
Save lexnewgate/28663fecae78324a87f38aa9c2e0a293 to your computer and use it in GitHub Desktop.
Lua- number to binary string
local function numberToBinStr(x)
ret=""
while x~=1 and x~=0 do
ret=tostring(x%2)..ret
x=math.modf(x/2)
end
ret=tostring(x)..ret
return ret
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment