generate_scope

Generates a ready to use entity Scope from an initialized entity.

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
local e = entityAPI.new({
    id = id
    name = "Ad-Hoc Test Entity",
    description = "Ad-Hoc test entity",
    attributes = {},
    properties = {
        { name = "level", value = 10, hide_from_conditions = false },
    }
})

local scope = e:generate_scope()
assert(scope ~= nil)
assert(scope.id == id)
assert(scope.name == "Ad-Hoc Test Entity")