Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't convert function to string properly (JavaScript) #607

Closed
planer28 opened this issue May 25, 2018 · 6 comments
Closed

Can't convert function to string properly (JavaScript) #607

planer28 opened this issue May 25, 2018 · 6 comments

Comments

@planer28
Copy link

I wrote an operating system-like thing, and wanted it's terminal to show the lengths of the programs (which are stored as functions), however everything I tried returns function () { [ecmascript code] }.

@AnastasiaDunbar
Copy link

This is a Duktape issue.

@planer28
Copy link
Author

Uh, so I assume it can't be easily fixed from here?

@AnastasiaDunbar
Copy link

AnastasiaDunbar commented May 31, 2018

You do also know that whitespace in functions are included when it's converted to string? Also see this.
You could also write your programs like:

var program="\
function(){\n\
 print(\"Hello.\",0,0);\n\
}";

@planer28
Copy link
Author

Yeah, but I have a whole set of system software built the way it is, plus it just makes the thing longer.
AND I also like the syntax highlighting.

@AnastasiaDunbar
Copy link

I can't help you here for now because I don't know what you'd do. I'm not sure if there's a better JavaScript engine that TIC-80 could use too.

@planer28
Copy link
Author

I understand. I mean, it ain't like using the terminal for checking sizes of programs is important in a graphical operating system, so I actually don't care too much about it :P

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants