Wizards of Lua

The Art of Spell Crafting


Alpha 1.2.0 is Released

The new 1.2.0-alpha contains two new features. Now you can query for entities, and you can modify the nbt data of an entity.

Example: Querying Entities

This will print the number of all players currently logged in:

found = Entities.find( "@e[type=Player]")
print( #found)

Example: Reading Entity NBT data

This will print the NBT data of the spell’s owner:

print( str( spell.owner.nbt))

Example: Modifying Entity NBT data

Setting the health of all bats to 1.

for _,e in Entities.find("@e[type=Bat]") do
  e:putNbt({Health=1})
end