mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-30 16:20:21 +00:00
Merge branch 'lua_object_var' into 'master'
Add lua binding for gameObject globalVariable See merge request OpenMW/openmw!3483
This commit is contained in:
commit
f547cd5934
@ -211,6 +211,13 @@ namespace MWLua
|
|||||||
objectT["isValid"] = [](const ObjectT& o) { return !o.ptrOrEmpty().isEmpty(); };
|
objectT["isValid"] = [](const ObjectT& o) { return !o.ptrOrEmpty().isEmpty(); };
|
||||||
objectT["recordId"] = sol::readonly_property(
|
objectT["recordId"] = sol::readonly_property(
|
||||||
[](const ObjectT& o) -> std::string { return o.ptr().getCellRef().getRefId().serializeText(); });
|
[](const ObjectT& o) -> std::string { return o.ptr().getCellRef().getRefId().serializeText(); });
|
||||||
|
objectT["globalVariable"] = sol::readonly_property([](const ObjectT& o) -> sol::optional<std::string> {
|
||||||
|
std::string globalVariable = o.ptr().getCellRef().getGlobalVariable();
|
||||||
|
if (globalVariable.empty())
|
||||||
|
return sol::nullopt;
|
||||||
|
else
|
||||||
|
return ESM::RefId::stringRefId(globalVariable).serializeText();
|
||||||
|
});
|
||||||
objectT["cell"] = sol::readonly_property([](const ObjectT& o) -> sol::optional<Cell<ObjectT>> {
|
objectT["cell"] = sol::readonly_property([](const ObjectT& o) -> sol::optional<Cell<ObjectT>> {
|
||||||
const MWWorld::Ptr& ptr = o.ptr();
|
const MWWorld::Ptr& ptr = o.ptr();
|
||||||
MWWorld::WorldModel* wm = MWBase::Environment::get().getWorldModel();
|
MWWorld::WorldModel* wm = MWBase::Environment::get().getWorldModel();
|
||||||
|
@ -167,6 +167,7 @@
|
|||||||
-- @field #any type Type of the object (one of the tables from the package @{openmw.types#types}).
|
-- @field #any type Type of the object (one of the tables from the package @{openmw.types#types}).
|
||||||
-- @field #number count Count (>1 means a stack of objects).
|
-- @field #number count Count (>1 means a stack of objects).
|
||||||
-- @field #string recordId Returns record ID of the object in lowercase.
|
-- @field #string recordId Returns record ID of the object in lowercase.
|
||||||
|
-- @field #string globalVariable Global Variable associated with this object(read only).
|
||||||
|
|
||||||
---
|
---
|
||||||
-- Does the object still exist and is available.
|
-- Does the object still exist and is available.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user