MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / dukglue_register_constructor

Function dukglue_register_constructor

Source/Utils/dukglue/register_class.h:9–21  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7// Set the constructor for the given type.
8template<class Cls, typename... Ts>
9void dukglue_register_constructor(duk_context* ctx, const char* name)
10{
11 duk_c_function constructor_func = dukglue::detail::call_native_constructor<false, Cls, Ts...>;
12
13 duk_push_c_function(ctx, constructor_func, sizeof...(Ts));
14
15 // set constructor_func.prototype
16 dukglue::detail::ProtoManager::push_prototype<Cls>(ctx);
17 duk_put_prop_string(ctx, -2, "prototype");
18
19 // set name = constructor_func
20 duk_put_global_string(ctx, name);
21}
22
23template<class Cls, typename... Ts>
24void dukglue_register_constructor_managed(duk_context* ctx, const char* name)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected