diff --git a/src/ui/CSimpleCheckbox.cpp b/src/ui/CSimpleCheckbox.cpp index d56dc9b..25f0f2f 100644 --- a/src/ui/CSimpleCheckbox.cpp +++ b/src/ui/CSimpleCheckbox.cpp @@ -34,3 +34,7 @@ bool CSimpleCheckbox::IsA(int32_t type) { || type == CScriptRegion::s_objectType || type == CScriptObject::s_objectType; } + +int32_t CSimpleCheckbox::GetChecked() { + return this->m_checked; +} diff --git a/src/ui/CSimpleCheckbox.hpp b/src/ui/CSimpleCheckbox.hpp index 28e1ce6..78fb381 100644 --- a/src/ui/CSimpleCheckbox.hpp +++ b/src/ui/CSimpleCheckbox.hpp @@ -26,6 +26,7 @@ class CSimpleCheckbox : public CSimpleButton { // Member functions CSimpleCheckbox(CSimpleFrame* parent) : CSimpleButton(parent) {}; + int32_t GetChecked(); }; #endif diff --git a/src/ui/CSimpleCheckboxScript.cpp b/src/ui/CSimpleCheckboxScript.cpp index 073c8e1..5a6cfcc 100644 --- a/src/ui/CSimpleCheckboxScript.cpp +++ b/src/ui/CSimpleCheckboxScript.cpp @@ -1,4 +1,6 @@ #include "ui/CSimpleCheckboxScript.hpp" +#include "ui/CSimpleCheckbox.hpp" +#include "util/Lua.hpp" #include "util/Unimplemented.hpp" #include @@ -7,7 +9,16 @@ int32_t CSimpleCheckbox_SetChecked(lua_State* L) { } int32_t CSimpleCheckbox_GetChecked(lua_State* L) { - WHOA_UNIMPLEMENTED(0); + auto type = CSimpleCheckbox::GetObjectType(); + auto checkbox = static_cast(FrameScript_GetObjectThis(L, type)); + + if (checkbox->GetChecked()) { + lua_pushnumber(L, 1.0); + } else { + lua_pushnil(L); + } + + return 1; } int32_t CSimpleCheckbox_GetCheckedTexture(lua_State* L) {