User:Kaeza/Test

From Minetest Developer Wiki
Revision as of 23:23, 18 June 2013 by Kaeza (talk | contribs)
Jump to navigation Jump to search

add_entity

minetest.add_entity(pos, name)

Spawns a Lua-defined entity at the specified position.

The name parameter specifies the name of the entity to add, which must have been previously registered via a call to register_entity.

Returns the new entity as a LuaObjectRef.

Example

local pos
local entity = minetest.add_entity(pos, "foo_mod:bar_entity")

-- Do something with it.
entity:setacceleration({x=0, y=-1, z=0})