generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

[CHALLENGE] Print function

Previous Thread :: Next Thread 
NXTBoy is not online. NXTBoy
Joined: 25 Aug 2008
Total Posts: 4533
17 Jan 2013 04:03 PM
@popin:

Ok, here's one that takes a pointer to the first character, cleans up the stack, and returns the pointer to the end of the string :

    0^<​0^9?P1+08-8-gd!

Decoded:
    
    stack = [ptr]

    0^< - Copy the top element and dereference it: stack = [ptr, *ptr]
    0^ - copy the value read: stack = [ptr, *ptr, *ptr]
    9? - if zero, branch to the end: stack = [ptr, *ptr]
    P - print: stack = [ptr]
    1+     - increment pointer stack = [ptr+1]
    08-8-g - Jump back to line 1

    d! - pop the null of the stack, leaving the pointer to the end of the string

    stack = [ptr+len(string)]


> Yours relies on the string starting at 0

Replace the first 0 in my previous answer with N, and you're there.

> and uses errors to terminate effectively.

No, it uses null-terminated strings - in HackVM, uninitialiazed memory is set to 0
Report Abuse
popinman322 is not online. popinman322
Joined: 04 Mar 2009
Total Posts: 5184
17 Jan 2013 04:34 PM
You're still not returning from the subroutine... >.>
Report Abuse
Previous Thread :: Next Thread 
Page 2 of 2Go to page: 1, [2] Prev
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image