Jump to content




Help needed converting numbers to binary.


  • You cannot reply to this topic
4 replies to this topic

#1 Dahknee

  • Members
  • 1,808 posts
  • Location/home/da

Posted 23 March 2015 - 11:16 AM

View PostAlice, on 29 August 2014 - 11:32 PM, said:

code
I wrote this literally today. Noticing this post is about a week old, I hope it's still helpful.
EDIT: Oh my God is it really 2014? I'M SORRY FOR NECROING THIS

This doesn't work...

#2 Dahknee

  • Members
  • 1,808 posts
  • Location/home/da

Posted 23 March 2015 - 03:21 PM

View PostDannySMc, on 23 March 2015 - 11:16 AM, said:

View PostAlice, on 29 August 2014 - 11:32 PM, said:

code
I wrote this literally today. Noticing this post is about a week old, I hope it's still helpful.
EDIT: Oh my God is it really 2014? I'M SORRY FOR NECROING THIS

This doesn't work...

Why has this been moved to ask a pro? I just pointed out it didn't work? -.-

Well now it is here, can anyone fix that?:D

#3 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 23 March 2015 - 03:28 PM

It wasn't moved. You necro'd an ancient Ask a Pro topic with what would be a useless post if you weren't looking for help with that code. I gave you the benefit of the doubt and split the post into its own new topic so you can get a more full answer. For anyone curious about the content of the original topic, follow the link in the quote in the first post here, the arrow just left of, "Alice, on ...".

#4 Dahknee

  • Members
  • 1,808 posts
  • Location/home/da

Posted 23 March 2015 - 03:58 PM

Fair enough, well if anyone can actually fix this... I want to get a few functions that will convert strings/numbers to binary and then back again...?

#5 Dragon53535

  • Members
  • 973 posts
  • LocationIn the Matrix

Posted 23 March 2015 - 07:30 PM

*cough* Made it months ago for strings. *cough* Also, you can use the numberString function to turn numbers TO binary. and the built in tonumber function to convert numbers from binary, as such:

numberString(100) --> 1100100
toBinary("b") --> 01100100 (b is technically the char 100)
fromBinary("01100100") --> b
tonumber(1100100,2) --> 100 (from base 2, you need that ,2 at the end so that it knows

Edited by Dragon53535, 23 March 2015 - 09:36 PM.






2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users