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

getGlobalVar return the var as haxe value (rebased) #10

Merged
merged 2 commits into from
Jul 25, 2024

Conversation

NQNStudios
Copy link
Contributor

I rebased #8 and made the test work on all targets.

On C++ there's an unfortunate behavior where you can't write

var foo:Foo = lua.getGlobalVar("foo");
// foo will be set to null!!

That's because Foo is a class, and the anonymous object returned by toHaxeObj() is not an instance of the Foo class, even though it implements the same interface (although the functions will be null variables because they don't convert).

So to write the test I've done

var foo:{a:Int} = lua.getGlobalVar('foo');

@kevinresol
Copy link
Owner

I think supporting Haxe class instance in the current way was a bad decision. I would recommend staying away from that for now until a proper revisit.

@kevinresol kevinresol merged commit 150ffd9 into kevinresol:master Jul 25, 2024
6 checks passed
@NQNStudios
Copy link
Contributor Author

NQNStudios commented Jul 25, 2024 via email

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 this pull request may close these issues.

2 participants