static duk_ret_t EntityReference_Lookup_Scene(duk_context* ctx) { EntityReference* thisObj = GetThisValueObject<EntityReference>(ctx, EntityReference_ID); Scene* scene = GetWeakObject<Scene>(ctx, 0); EntityPtr ret = thisObj->Lookup(scene); PushWeakObject(ctx, ret.Get()); return 1; }
QScriptValue EntityReference_prototype_Lookup(QScriptContext *ctx, QScriptEngine *engine) { int argCount = ctx->argumentCount(); if (argCount != 1) return ctx->throwError(QScriptContext::TypeError, "EntityReference Lookup(): Invalid number of arguments."); if (!ctx->argument(0).isQObject()) return ctx->throwError(QScriptContext::TypeError, "EntityReference Lookup(): Argument is not a QObject"); Scene* scene = dynamic_cast<Scene*>(ctx->argument(0).toQObject()); EntityReference s; fromScriptValueEntityReference(ctx->thisObject(), s); EntityPtr entity = s.Lookup(scene); return engine->newQObject(entity.get()); }