mirror of
https://github.com/whoahq/whoa.git
synced 2026-03-18 05:31:07 +03:00
feat(ui): add proper ScriptIx dtor
Some checks are pending
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:cl compiler_name:MSVC cxx:cl os:windows-latest system_name:Windows test_path:WhoaTest]) (push) Waiting to run
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:clang compiler_name:Clang cxx:clang++ os:macos-latest system_name:macOS test_path:WhoaTest]) (push) Waiting to run
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:gcc compiler_name:GCC cxx:g++ os:ubuntu-latest system_name:Linux test_path:WhoaTest]) (push) Waiting to run
Some checks are pending
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:cl compiler_name:MSVC cxx:cl os:windows-latest system_name:Windows test_path:WhoaTest]) (push) Waiting to run
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:clang compiler_name:Clang cxx:clang++ os:macos-latest system_name:macOS test_path:WhoaTest]) (push) Waiting to run
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:gcc compiler_name:GCC cxx:g++ os:ubuntu-latest system_name:Linux test_path:WhoaTest]) (push) Waiting to run
This commit is contained in:
parent
8d1316b163
commit
1589466076
@ -5,6 +5,12 @@
|
|||||||
|
|
||||||
int32_t FrameScript_Object::s_objectTypes = 0;
|
int32_t FrameScript_Object::s_objectTypes = 0;
|
||||||
|
|
||||||
|
FrameScript_Object::ScriptIx::~ScriptIx() {
|
||||||
|
if (this->luaRef) {
|
||||||
|
luaL_unref(FrameScript_GetContext(), LUA_REGISTRYINDEX, this->luaRef);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int32_t FrameScript_Object::CreateScriptMetaTable(lua_State* L, void (*a2)(lua_State* L)) {
|
int32_t FrameScript_Object::CreateScriptMetaTable(lua_State* L, void (*a2)(lua_State* L)) {
|
||||||
lua_createtable(L, 0, 0);
|
lua_createtable(L, 0, 0);
|
||||||
lua_pushstring(L, "__index");
|
lua_pushstring(L, "__index");
|
||||||
@ -24,12 +30,6 @@ void FrameScript_Object::FillScriptMethodTable(lua_State *L, FrameScript_Method
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FrameScript_Object::~FrameScript_Object() {
|
|
||||||
if (this->m_onEvent.luaRef) {
|
|
||||||
luaL_unref(FrameScript_GetContext(), LUA_REGISTRYINDEX, this->m_onEvent.luaRef);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* FrameScript_Object::GetDisplayName() {
|
const char* FrameScript_Object::GetDisplayName() {
|
||||||
const char* name = this->GetName();
|
const char* name = this->GetName();
|
||||||
return name ? name : "<unnamed>";
|
return name ? name : "<unnamed>";
|
||||||
|
|||||||
@ -14,6 +14,7 @@ class FrameScript_Object {
|
|||||||
struct ScriptIx {
|
struct ScriptIx {
|
||||||
int32_t luaRef = 0;
|
int32_t luaRef = 0;
|
||||||
const char* unk = nullptr;
|
const char* unk = nullptr;
|
||||||
|
~ScriptIx();
|
||||||
};
|
};
|
||||||
|
|
||||||
class ScriptFunction {
|
class ScriptFunction {
|
||||||
@ -34,7 +35,7 @@ class FrameScript_Object {
|
|||||||
ScriptIx m_onEvent;
|
ScriptIx m_onEvent;
|
||||||
|
|
||||||
// Virtual member functions
|
// Virtual member functions
|
||||||
virtual ~FrameScript_Object();
|
virtual ~FrameScript_Object() = default;
|
||||||
virtual char* GetName() = 0;
|
virtual char* GetName() = 0;
|
||||||
virtual int32_t GetScriptMetaTable() = 0;
|
virtual int32_t GetScriptMetaTable() = 0;
|
||||||
virtual ScriptIx* GetScriptByName(const char* name, ScriptData& data);
|
virtual ScriptIx* GetScriptByName(const char* name, ScriptData& data);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user