-
Notifications
You must be signed in to change notification settings - Fork 560
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
Override language primitives #1191
Comments
For the string case there is no easy way, either your API also support char* or std::string_view, or you have to convert back and forth. |
It does look like the string class has a char* of some sort. But I suppose I would have to expose it as its own class for using the API this string class has? I suppose it would help me not to be vague here. I was playing around with adding Wren language support to Godot game engine. Godot does indeed have a RefCounted class that works with its RC system. All of its primitive types lie beneath a Variant class as well, which may help. The structure looks like this:
I don't know if it would be possible to properly expose these Variant types to Wren. |
Technically you can provide your own String class. The thing is that you'll need to guess the place where you need to convert from your string to wren string (thought a lot can already be done using the toString/fromString methods) It is not really complicated, just tedious. You need to invoke something like in a constructor:
And in methods and destructor uses
The biggest pitfall is that you have to validate arguments outside of the binding (in wren directly before the binding), since only |
I see. Alright, if I have any more questions, I will return. |
If I wanted to embed wren into a game engine that has its own primitives (such as String) that have their own API, is that possible? This engine also uses reference counting instead of GC for memory management; how would these 2 systems be able to work together? Do I just hold on to the wren handle until the RC cleanup?
The text was updated successfully, but these errors were encountered: