mirror of
https://github.com/whoahq/whoa.git
synced 2026-03-05 15:42:17 +03:00
feat(ui): partially implement CSimpleFrame_GetAttribute
This commit is contained in:
parent
3d8073cf75
commit
c201da76cd
@ -180,7 +180,32 @@ int32_t CSimpleFrame_CanChangeAttributes(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t CSimpleFrame_GetAttribute(lua_State* L) {
|
int32_t CSimpleFrame_GetAttribute(lua_State* L) {
|
||||||
|
auto type = CSimpleFrame::GetObjectType();
|
||||||
|
auto frame = static_cast<CSimpleFrame*>(FrameScript_GetObjectThis(L, type));
|
||||||
|
|
||||||
|
// 3 argument form
|
||||||
|
if (lua_gettop(L) == 4 && lua_isstring(L, 3)) {
|
||||||
|
// TODO 3 argument form isn't handled yet
|
||||||
WHOA_UNIMPLEMENTED(0);
|
WHOA_UNIMPLEMENTED(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 1 argument form
|
||||||
|
if (lua_isstring(L, 2)) {
|
||||||
|
auto attrName = lua_tostring(L, 2);
|
||||||
|
int32_t luaRef;
|
||||||
|
|
||||||
|
if (frame->GetAttribute(attrName, luaRef)) {
|
||||||
|
lua_rawgeti(L, LUA_REGISTRYINDEX, luaRef);
|
||||||
|
} else {
|
||||||
|
lua_pushnil(L);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Invalid call
|
||||||
|
luaL_error(L, "Usage: %s:GetAttribute(\"name\")", frame->GetDisplayName());
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t CSimpleFrame_SetAttribute(lua_State* L) {
|
int32_t CSimpleFrame_SetAttribute(lua_State* L) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user