Resource
Engine
(NOTE) A table of resources (or strings) that can be indexed, searched by name, or sampled randomly. The table can be randomly sampled to return an entry into the table.
Methods | Properties | Base Classes | Derived Classes |
---|---|---|---|
AddOrError | All | dataresource | |
AddOrIgnore | Count | ||
AddOrOverwrite | MaxWeight | ||
Clear | ResourceType | ||
Contains | |||
CreateRuntime | |||
ForceRebuild | |||
Get | |||
GetOrDefault | |||
GetOrError | |||
GetOrNull | |||
RemoveAt | |||
RemoveOrError | |||
RemoveOrIgnore | |||
RuntimeClone | |||
Sample | |||
SampleIndex | |||
Set |
Properties
All : resourcetableentryrange
read-only
Range to iterate over all entries.
var All : ResourceTableEntryRange
Count : integer
read-only
How many items are stored in the table.
var Count : Integer
MaxWeight : real
The maximum probability weight value that can be stored in the table. Setting this will clamp all weight values.
var MaxWeight : Real
ResourceType : string
The kind of resource contained in this table. This is either a resource type or "String".
var ResourceType : String
Methods
AddOrError : Void
Add the given entry. If another entry with the same name exists then an error is thrown. |Name|Type|Description| |---|---|---| |entry|resourcetableentry| |
function AddOrError(entry : ResourceTableEntry)
AddOrIgnore : boolean
Add the given entry. If another entry with the same name exists then no operation is performed. |Name|Type|Description| |---|---|---| |entry|resourcetableentry| |
function AddOrIgnore(entry : ResourceTableEntry) : Boolean
AddOrOverwrite : boolean
Add the given entry. If another entry with the same name exists then it is overwritten. |Name|Type|Description| |---|---|---| |entry|resourcetableentry| |
function AddOrOverwrite(entry : ResourceTableEntry) : Boolean
Clear : Void
Clear all items in the table. |Name|Type|Description| |---|---|---|
function Clear()
Contains : boolean
Returns if the given key is contained. |Name|Type|Description| |---|---|---| |key|string| |
function Contains(key : String) : Boolean
CreateRuntime : resourcetable
static
Creates a ResourceTable for run-time modifications. |Name|Type|Description| |---|---|---|
function CreateRuntime() : ResourceTable
ForceRebuild : Void
Force rebuild the weighted probability table. |Name|Type|Description| |---|---|---|
function ForceRebuild()
Get : resourcetableentry
Access an item at the given index. |Name|Type|Description| |---|---|---| |index|integer| |
function Get(index : Integer) : ResourceTableEntry
Get : resourcetableentry
Hash-Set interface. Gets the item with the same name as the entry. |Name|Type|Description| |---|---|---| |entry|resourcetableentry| |
function Get(entry : ResourceTableEntry) : ResourceTableEntry
Get : resourcetableentry
Hash-Map interface. Gets via the provided key. |Name|Type|Description| |---|---|---| |key|string| |
function Get(key : String) : ResourceTableEntry
GetOrDefault : resourcetableentry
Returns the entry associated with the given key. If no entry matches the key then the provided default is returned. |Name|Type|Description| |---|---|---| |key|string| | |defaultValue|resourcetableentry| |
function GetOrDefault(key : String, defaultValue : ResourceTableEntry) : ResourceTableEntry
GetOrError : resourcetableentry
Returns the entry associated with the given key. If no entry matches the key then an exception is thrown. |Name|Type|Description| |---|---|---| |key|string| |
function GetOrError(key : String) : ResourceTableEntry
GetOrNull : resourcetableentry
Returns the entry associated with the given key. If no entry matches then null is returned. |Name|Type|Description| |---|---|---| |key|string| |
function GetOrNull(key : String) : ResourceTableEntry
RemoveAt : Void
Removes the item at the given index. |Name|Type|Description| |---|---|---| |index|integer| |
function RemoveAt(index : Integer)
RemoveOrError : Void
Removes the entry associated with the given key. If no entry matches an exception is thrown. |Name|Type|Description| |---|---|---| |key|string| |
function RemoveOrError(key : String)
RemoveOrIgnore : boolean
Removes the entry associated with the given key. If no entry matches then no operation is performed. |Name|Type|Description| |---|---|---| |key|string| |
function RemoveOrIgnore(key : String) : Boolean
RuntimeClone : resourcetable
Creates a clone of this table for run-time modifications. |Name|Type|Description| |---|---|---|
function RuntimeClone() : ResourceTable
Sample : resourcetableentry
Samples the table to return a random entry. Takes two (different) random floats from [0,1) in order to sample. Returns an empty string if the table is empty. |Name|Type|Description| |---|---|---| |random1|real| | |random2|real| |
function Sample(random1 : Real, random2 : Real) : ResourceTableEntry
SampleIndex : integer
Samples the table to return a random index into the table. Takes two (different) random floats from [0,1) in order to sample. |Name|Type|Description| |---|---|---| |random1|real| | |random2|real| |
function SampleIndex(random1 : Real, random2 : Real) : Integer
Set : Void
Access an item at the given index. |Name|Type|Description| |---|---|---| |index|integer| | |entry|resourcetableentry| |
function Set(index : Integer, entry : ResourceTableEntry)
Set : Void
Hash-Set interface. Sets the item with the same name as the entry. |Name|Type|Description| |---|---|---| |entry|resourcetableentry| |
function Set(entry : ResourceTableEntry)
Set : Void
Hash-Map interface. Sets via the provided key. |Name|Type|Description| |---|---|---| |key|string| | |entry|resourcetableentry| |
function Set(key : String, entry : ResourceTableEntry)