• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Amount of items on the ground?

Taken from closingdoor.lua
Code:
...
	local tmpPos = {x = position.x, y = position.y, z = position.z, stackpos = -1}
	local tileCount = getTileThingByPos(tmpPos)

	local i = 1
	local tmpItem = {uid = 1}
	while(tmpItem.uid ~= 0 and i < tileCount) do
		tmpPos.stackpos = i
		tmpItem = getTileThingByPos(tmpPos)
		if(tmpItem.uid ~= item.uid and tmpItem.uid ~= 0 and isMoveable(tmpItem.uid)) then
			doRemoveItem(tmpItem.uid)
		else
			i = i + 1
		end
	end
...
You can use this as a base, and modify it of course to suit your needs.
 
Back
Top