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

Bug Report: hscript "forgets" variables sometimes #4215

Closed
3 tasks done
cyn0x8 opened this issue Feb 23, 2025 · 3 comments
Closed
3 tasks done

Bug Report: hscript "forgets" variables sometimes #4215

cyn0x8 opened this issue Feb 23, 2025 · 3 comments
Labels
status: duplicate Issue or PR is redundant to another.

Comments

@cyn0x8
Copy link
Contributor

cyn0x8 commented Feb 23, 2025

Issue Checklist

  • I have read the Contributing Guide
  • I have checked the Issues/Discussions pages to see if my issue has already been reported
  • I have properly titled my issue

Platform

Compiled from GitHub Source Code

Browser

None

Version

0.5.3

Description (include any images, videos, errors, or crash logs)

like the title says, hscript seems to kinda "forget" variables exist sometimes... and seemingly at random

its really annoying having to deal with this whenever it comes up and im completely stumped as to why this could be happening

sometimes what causes hscript to drop it is being a function parameter after the function ends like in #4158

public function example1(callback:()->Void, obj:Dynamic):Void {
    new FlxTimer().start(1, function():Void {
        callback(); // errors saying it cant find "callback"
        trace(Std.string(obj)); // will also error saying it cant find "obj"
    });
}

public function example2(callback:()->Void, obj:Dynamic):Void {
    var callback_persist:()->Void = callback;
    var obj_persist:Dynamic = obj;
    
    new FlxTimer().start(1, function():Void {
        callback_persist(); // works perfectly fine??????
        trace(Std.string(obj_persist)); // also works fine
        
        callback(); // still errors like in example1
        trace(Std.string(obj)); // still errors like in example1
    });
}

or immediately after the variable is used in a trace inside a threaded Future made by a function thats called by a Timer. but only sometimes. what??????

Image

Steps to Reproduce

unknown steps to reliably reproduce excluding #4158
hopefully more scenarios are found

@cyn0x8 cyn0x8 added status: pending triage Awaiting review. type: minor bug Involves a minor bug or issue. labels Feb 23, 2025
@cyn0x8 cyn0x8 marked this as a duplicate of #4158 Feb 23, 2025
@AbnormalPoof
Copy link
Collaborator

Closing this as a duplicate of #4158 since they're basically the same issue.

@AbnormalPoof AbnormalPoof added status: duplicate Issue or PR is redundant to another. and removed type: minor bug Involves a minor bug or issue. status: pending triage Awaiting review. labels Feb 24, 2025
Copy link

This issue is a duplicate. Please direct all discussion to the original issue.

@AbnormalPoof AbnormalPoof marked this as not a duplicate of #4158 Feb 24, 2025
@cyn0x8
Copy link
Contributor Author

cyn0x8 commented Feb 24, 2025

Closing this as a duplicate of #4158 since they're basically the same issue.

this was intended to be a more "general" version of that issue since ive had this happen to variables that werent function params

should i update the older issue with that info?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate Issue or PR is redundant to another.
Projects
None yet
Development

No branches or pull requests

2 participants