mirror of
https://github.com/aseprite/aseprite.git
synced 2024-12-29 09:23:32 +00:00
script: add className to Context::pushThis()
This commit is contained in:
parent
af7c6e0fa9
commit
5665ac848d
@ -45,7 +45,7 @@ script::result_t Sprite_ctor(script::ContextHandle handle)
|
||||
sprite.release();
|
||||
|
||||
doc->setContext(UIContext::instance());
|
||||
ctx.pushThis(unwrap_engine(ctx)->wrapSprite(doc.release()));
|
||||
ctx.pushThis(unwrap_engine(ctx)->wrapSprite(doc.release()), "Sprite");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -284,11 +284,17 @@ void Context::pushThis()
|
||||
duk_push_this(m_handle);
|
||||
}
|
||||
|
||||
void Context::pushThis(void* ptr)
|
||||
void Context::pushThis(void* ptr, const char* className)
|
||||
{
|
||||
duk_push_this(m_handle);
|
||||
duk_push_pointer(m_handle, ptr);
|
||||
duk_put_prop_string(m_handle, -2, kPtrId);
|
||||
|
||||
// TODO classes in modules isn't supported yet
|
||||
duk_get_global_string(m_handle, className);
|
||||
duk_get_prototype(m_handle, -1);
|
||||
duk_set_prototype(m_handle, -3);
|
||||
duk_pop_2(m_handle);
|
||||
}
|
||||
|
||||
void Context::pushPointer(void* ptr)
|
||||
|
@ -94,7 +94,7 @@ namespace script {
|
||||
void pushUInt(unsigned int val);
|
||||
void pushString(const char* str);
|
||||
void pushThis();
|
||||
void pushThis(void* ptr);
|
||||
void pushThis(void* ptr, const char* className);
|
||||
void pushPointer(void* ptr);
|
||||
index_t pushObject();
|
||||
index_t pushObject(void* ptr, const char* className);
|
||||
|
Loading…
Reference in New Issue
Block a user