Example:
Syntax: Select all
from players.helpers import index_from_userid
try:
index = index_from_userid(2)
except ValueError:
print('Failed to convert the userid into an index.')
We have also updated our listeners. Previously, they received an invalid value if the internal conversion failed. Now, the value is just None.
Example:
Syntax: Select all
from listeners import OnEntityCreated
@OnEntityCreated
def on_entity_created(index, entity):
if index is None:
# Internal conversion failed.
# The entity is probably a non-networked entity
print(entity.classname)