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

Using font() in JS causes RangeError #1052

Closed
kimnorth opened this issue Apr 17, 2020 · 4 comments · Fixed by #1053
Closed

Using font() in JS causes RangeError #1052

kimnorth opened this issue Apr 17, 2020 · 4 comments · Fixed by #1053

Comments

@kimnorth
Copy link

Hi,

I'm attempting to use the font() method for the first time in a game written in JS. I'm getting an error when I try to run the following code (adapted from the docs):

font('A',20,20,2,9,9,true,3)

The error being logged out into the console is:

RangeError: Invalid Stack Index 8

Screenshot 2020-04-17 at 23 14 07

There is definitely a sprite at the corresponding ASCII position for character "A" and when I run the same code as lua, it prints it out correctly to the screen. So it looks like an issue with the implementation in JS.

I am using v0.70.6

Thanks

@RobLoach
Copy link
Contributor

Could you provide a focused example?

@nesbox
Copy link
Owner

nesbox commented Apr 18, 2020

reproduced, but don't understand what causes the problem...

@kimnorth
Copy link
Author

This is the js version of the file I'm trying to run:

// title:  Font Demo
// author: PaulR
// desc:   Shows the working of font()
// script: js
function TIC(){
	cls()	
	font('A',20,20,2,9,9,true,3)
}

And this is the lua version of that script:

-- title:  Font Demo
-- author: PaulR
-- desc:   Shows the working of font()
-- script: lua
function TIC()
	cls()	
	font('A',20,20,2,9,9,true,3)
end

The lua version correctly prints out the sprite at that location in the sheet:

Screenshot 2020-04-18 at 14 23 04

@kimnorth
Copy link
Author

Amazing, thanks all!

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

Successfully merging a pull request may close this issue.

3 participants