Extended from BaseObject Environment¶
This class is used to storage objects and interact with them in an easier way
Properties¶
table Content¶
{ }
number Count¶
The amount of objects in this environment
Methods¶
Environment Constructor(instanceType: string?
)¶
any Get(index: string
)¶
Gets the object with the specified index
void SetOne(value: any, index: string
)¶
Adds an object with the specified index, if no parameter is specified it will use the next number of the count property as index
void AddOne(value: any, index: string
)¶
Adds an object with the specified index, if no parameter is specified it will use the next number of the count property as index
void RemoveOne(index: string
)¶
Removes the object with the specified index
boolean HasOne(index: string
)¶
Checks if the environment has a value with the specified index
(boolean, Dictionary) Has(objects: Array<string>
)¶
Checks if the environment contains every specified index and returns a boolean and a dictionary with boolean values, example:
local hasAll, dictionary = treeEnv:Has({
"Tree1",
"Tree2",
"Tree4"
})
print(hasAll, dictionary) -- output: false, { Tree1 = true, Tree2 = true, Tree4 = false }
void Add(objects: Dictionary<string, any>
)¶
Adds objects with the specified index
treeEnv:Add({
"Tree1" = tree.new(),
"Tree2" = tree.new(),
"Tree3" = tree.new()
})
print(treeEnv:Get("Tree2")) -- output: Tree2
void Remove(objects: Array<string>
)¶
Removes the objects with the specified index, example:
treeEnv:Remove({ "Tree1", "Tree2", "Tree3" })
print(treeEnv:Get("Tree2")) -- output: nil
void Update(objects: Dictionary<string, any>
)¶
Updates the objects with the specified index, example:
treeEnv:Update({
Tree1 = treeEnv:Get("Tree2"),
Tree2 = treeEnv:Get("Tree1"),
})
any FindByName(name: string
)¶
Finds an object by his name
void SetProperty(property: string, value: any
)¶
Sets the specified property in every object in the environment
void Run(method: string, ...any
)¶
Executes the specified methods in every object in the environment with the specified parameters
Events¶
Name |
Description |
---|---|