get_property

Lookup for a property with the given name in the entity properties map and returns it if it is present

Errors

  • If the property is not present in the entity
  • If the given name is empty

Example of Usage

-- bind the exposed entity UserData to a local variable
local entityAPI = alacrity.Entity

-- create a new random unique user ID
local id = alacrity.uuid.new_v4()

-- create a new Entity instance
local e = entityAPI.new({
    id = id,
    name = "Ad-Hoc Test Entity",
    description = "Ad-Hoc test entity",
    attributes = {},
    properties = {
        { name = "level", value = 1 },
    }
})

local property = e:get_property("level")
assert(property ~= nil)
assert(property.name == "level")
assert(property.value.Value == 1)