base class —
This is a list like object used in the game engine internally that behaves similar to a python list in most ways.
As well as the normal index lookup (
val= clist[i]), CListValue supports string lookups (
Other operations such as
clist[0:10]are also supported.
Add an item to the list (like pythons append)
Appending values to the list can cause crashes when the list is used internally by the game engine.
Count the number of instances of a value in the list.
number of instances
- Return type
Return the index of a value in the list.
The index of the value in the list.
- Return type
Reverse the order of the list.
Return the value matching key, or the default value if its not found.
The key value or a default.
Return a list of items with name matching name regex and with a property matching prop regex. If name is empty every items are checked, if prop is empty no property check is proceeded.
The list of matching items.
This is a funtion especially for the game engine to return a value with a spesific id.
Since object names are not always unique, the id of an object can be used to get an object from the CValueList.
myObID=id(gameObject) ob= scene.objects.from_id(myObID)
myObIDis an int or long from the id function.
This has the advantage that you can store the id in places you could not store a gameObject.
The id is derived from a memory location and will be different each time the game engine starts.
The id can’t be stored as an integer in game object properties, as those only have a limited range that the id may not be contained in. Instead an id can be stored as a string game property and converted back to an integer for use in from_id lookups.