diff --git a/src/client/game/structs.hpp b/src/client/game/structs.hpp index ca0637f8..82d8f2c0 100644 --- a/src/client/game/structs.hpp +++ b/src/client/game/structs.hpp @@ -943,10 +943,11 @@ namespace game }; struct HashTable; + struct cclosure; union HksValue { - void* cClosure; + cclosure* cClosure; void* closure; UserData* userData; HashTable* table; @@ -1114,5 +1115,15 @@ namespace game unsigned int m_arraySize; Node* m_freeNode; }; + + struct cclosure : ChunkHeader + { + lua_function m_function; + HashTable* m_env; + __int16 m_numUpvalues; + __int16 m_flags; + InternString* m_name; + HksObject m_upvalues[1]; + }; } } \ No newline at end of file diff --git a/src/client/game/ui_scripting/types.cpp b/src/client/game/ui_scripting/types.cpp index d72050fd..0f501bf1 100644 --- a/src/client/game/ui_scripting/types.cpp +++ b/src/client/game/ui_scripting/types.cpp @@ -85,8 +85,9 @@ namespace ui_scripting * Function **************************************************************/ - function::function(void* ptr_) + function::function(game::hks::cclosure* ptr_, game::hks::HksObjectType type_) : ptr(ptr_) + , type(type_) { } diff --git a/src/client/game/ui_scripting/types.hpp b/src/client/game/ui_scripting/types.hpp index a63ded36..bfcfb7ed 100644 --- a/src/client/game/ui_scripting/types.hpp +++ b/src/client/game/ui_scripting/types.hpp @@ -41,10 +41,11 @@ namespace ui_scripting class function { public: - function(void*); + function(game::hks::cclosure*, game::hks::HksObjectType); arguments call(const arguments& arguments) const; - void* ptr; + game::hks::cclosure* ptr; + game::hks::HksObjectType type; }; } diff --git a/src/client/game/ui_scripting/value.cpp b/src/client/game/ui_scripting/value.cpp index 0a117d32..d48d12e9 100644 --- a/src/client/game/ui_scripting/value.cpp +++ b/src/client/game/ui_scripting/value.cpp @@ -89,7 +89,7 @@ namespace ui_scripting value::value(const function& value) { - this->value_.t = game::hks::TIFUNCTION; + this->value_.t = value.type; this->value_.v.ptr = value.ptr; } @@ -259,13 +259,14 @@ namespace ui_scripting template <> bool value::is() const { - return this->get_raw().t == game::hks::TIFUNCTION; + return this->get_raw().t == game::hks::TIFUNCTION + || this->get_raw().t == game::hks::TCFUNCTION; } template <> function value::get() const { - return this->get_raw().v.ptr; + return {this->get_raw().v.cClosure, this->get_raw().t}; } /***************************************************************