HOTFIX: dirty label flag script access

This commit is contained in:
BlackMATov
2020-02-07 11:26:21 +07:00
parent 7075fb4fb4
commit 1d3a00b15d
2 changed files with 16 additions and 0 deletions

View File

@@ -1,5 +1,8 @@
---@class label ---@class label
local label = { local label = {
---@type boolean
dirty = false,
---@type string ---@type string
text = "", text = "",

View File

@@ -15,6 +15,19 @@ namespace e2d::bindings::high
l.new_usertype<gcomponent<label>>("label", l.new_usertype<gcomponent<label>>("label",
sol::no_constructor, sol::no_constructor,
"dirty", sol::property(
[](const gcomponent<label>& c) -> bool {
return c.owner().component<label::dirty>().exists();
},
[](gcomponent<label>& c, bool yesno){
if ( yesno ) {
c.owner().component<label::dirty>().ensure();
} else {
c.owner().component<label::dirty>().remove();
}
}
),
"text", sol::property( "text", sol::property(
[](const gcomponent<label>& c) -> str { [](const gcomponent<label>& c) -> str {
return c->text(); return c->text();