minetest.spawn_item

From Minetest Developer Wiki
Jump to: navigation, search

Syntax

minetest.spawn_item(pos, item)


Description

This function spawns a "__builtin:item" at pos and returns its object.

Examples

function nodeName()
local zahl = math.random(1, 10)
 
 
if zahl < 10 then
name = "default:diamond"
end
 
if zahl < 5 then
name = "default:apple 5"
end
end
 
minetest.after(5,function()
for i = 10000,1,-1
do
	nodeName()
	minetest.add_item({x=math.random(-1000,1000), y=math.random(30), z=math.random(-1000,1000)}, name)
	minetest.chat_send_all(name)
end
end)

This will spawn 1000 apples or diamonds in a range from -1000 to 1000 blocks in x and z.

Mbox important.png This article is incomplete.
Please help expand this article to include more useful information.
Personal tools
Namespaces

Variants
Actions
Navigation
API
Toolbox