LuaWorld
Type doc:
Represents the bevy world all scripts live in.
Provides ways to interact with and modify the world.
Fields:
Methods:
get_type_by_name: function(self: LuaWorld , string):( LuaTypeRegistration )
Retrieves type information given either a short (MyType
) or fully qualified rust type name (MyModule::MyType
).
Returns nil
if no such type exists or if one wasn't registered on the rust side.
This is used extensively in [LuaWorld
]
add_default_component: function(self: LuaWorld , LuaEntity , LuaTypeRegistration ):( ReflectedValue )
Inserts a component of the given type to the given entity by instantiating a default version of it.
The component can then be modified using field access.
get_component: function(self: LuaWorld , LuaEntity , LuaTypeRegistration ):( ReflectedValue )
Retrieves a component of the given type from the given entity.
If such a component does not exist returns nil
.
has_component: function(self: LuaWorld , LuaEntity , LuaTypeRegistration ):(boolean)
Returns true
if the given entity contains a component of the given type.
get_resource: function(self: LuaWorld , LuaTypeRegistration ):( ReflectedValue )
Retrieves a resource of the given type from the world.
If such a resource does not exist returns nil
.
remove_resource: function(self: LuaWorld , LuaTypeRegistration )
Removes the given resource from the world, if one doesn't exist it does nothing.
has_resource: function(self: LuaWorld , LuaTypeRegistration ):(boolean)
Returns true
if the world contains a resource of the given type.
Retrieves children entities of the parent entity if it has any.
Retrieves the parent entity of the given entity if it has any.
Attaches children entities to the given parent entity.
Removes children entities from the given parent entity.
Removes child entity from the given parent entity.
Inserts children entities to the given parent entity at the given index.
Inserts child entity to the given parent entity at the given index.
Despawns the given entity's children recursively
Despawns the given entity and the entity's children recursively
Despawns the given entity if it exists, returns true if deletion was successfull
query: function(self: LuaWorld , ...: LuaTypeRegistration ):( LuaQueryBuilder )
Creates a LuaQueryBuilder, querying for the passed components types.
Can be iterated over using LuaQueryBuilder:iter()
remove_component: function(self: LuaWorld , LuaEntity , LuaTypeRegistration )
Removes the given component from the given entity, does nothing if it doesn't exist on the entity.
Attaches child entity to the given parent entity.
__tostring: function(self: LuaWorld ):(string)