manerinhu
I'm very very MaNeRiNhU
Hi,
Probably there are some others functions like this already made, but I have made this one and I want to share with you, guys.
This functions, as the name says, gets and returns in a table itemids from a square around a predetermined position. It may be useful in some way for someone.
You may use it associated to isInArray, as it returns a table.
Created by me. (also called Deragon)
Helped by iuniX and Elwyn.
Probably there are some others functions like this already made, but I have made this one and I want to share with you, guys.
This functions, as the name says, gets and returns in a table itemids from a square around a predetermined position. It may be useful in some way for someone.
You may use it associated to isInArray, as it returns a table.
Lua:
function getNearbyItems(posa)
local items = {}
local posx = {
{-1, 0, 1},
{-1, 0, 1},
{-1, 0, 1}
}
local posy = {
{-1, -1, -1},
{0, 0, 0},
{1, 1, 1}
}
for i = 1, #posx do
for c = 1, #posy do
local item = getThingFromPos({x = posa.x+posx[i][c], y = posa.y+posy[i][c], z = posa.z, stackpos = 255}).itemid
table.insert(items, item)
end
end
return items
end
Created by me. (also called Deragon)
Helped by iuniX and Elwyn.
Last edited: