We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
To better explain what the issue is, I just wanted to be able to do something like this:
duk_push_object(ctx); dukglue_register_constructor<Dog>(ctx, "Dog"); dukglue_register_constructor<Dog>(ctx, "Cat"); duk_put_global_string(ctx, "Animal");
so that they can be used like so:
var dog = new Animal.Dog(); var cat = new Animal.Cat();
However, Dog and Cat always appear in the global scope instead of in the Animal scope.
Dog
Cat
Animal
The text was updated successfully, but these errors were encountered:
I managed to get this to work by modifying a copy of dukglue code locally like so:
in register_class.h:
register_class.h
// set name = constructor_func duk_put_global_string(ctx, name);
into
// set name = constructor_func duk_put_prop_string(ctx, -2, name);
However, this breaks the ability to put classes in the global scope. I hope there is a better way to achieve my goal.
Sorry, something went wrong.
I think you could use this technique for defining an explicit global object: http://wiki.duktape.org/HowtoGlobalObjectReference.html
global
...then use your register_class modification, but specify "global" for the target when that is what you want.
register_class
"global"
No branches or pull requests
To better explain what the issue is, I just wanted to be able to do something like this:
so that they can be used like so:
However,
Dog
andCat
always appear in the global scope instead of in theAnimal
scope.The text was updated successfully, but these errors were encountered: