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.

get_children: function(self: LuaWorld , LuaEntity ):({ LuaEntity })

Retrieves children entities of the parent entity if it has any.

get_parent: function(self: LuaWorld , LuaEntity ):( LuaEntity )

Retrieves the parent entity of the given entity if it has any.

push_children: function(self: LuaWorld , LuaEntity , { LuaEntity })

Attaches children entities to the given parent entity.

remove_children: function(self: LuaWorld , LuaEntity , { LuaEntity })

Removes children entities from the given parent entity.

remove_child: function(self: LuaWorld , LuaEntity , LuaEntity )

Removes child entity from the given parent entity.

insert_children: function(self: LuaWorld , LuaEntity , integer , { LuaEntity })

Inserts children entities to the given parent entity at the given index.

insert_child: function(self: LuaWorld , LuaEntity , integer , LuaEntity )

Inserts child entity to the given parent entity at the given index.

despawn_children_recursive: function(self: LuaWorld , LuaEntity )

Despawns the given entity's children recursively

despawn_recursive: function(self: LuaWorld , LuaEntity )

Despawns the given entity and the entity's children recursively

spawn: function(self: LuaWorld ):( LuaEntity )

Spawns a new entity and returns its Entity ID

despawn: function(self: LuaWorld , LuaEntity ):(boolean)

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.

push_child: function(self: LuaWorld , LuaEntity , LuaEntity )

Attaches child entity to the given parent entity.

__tostring: function(self: LuaWorld ):(string)