mirror of
https://github.com/minetest-mods/areas.git
synced 2024-12-25 02:00:40 +01:00
api.lua:5: attempt to index local 'pos' (a nil value)
This was suggested by RBA to fix the follow. ``` 18:43:28: ACTION[ServerThread]: Sofia punches object -27616: LuaEntitySAO at (13.9607,18.7545,-77.3249) 18:43:41: ERROR[main]: ERROR: An unhandled exception occurred: /home/minetest/Server/bin/../mods/areas/api.lua:5: attempt to index local 'pos' (a nil value) 18:43:41: ERROR[main]: stack traceback: 18:43:41: ERROR[main]: /home/minetest/Server/bin/../mods/areas/api.lua:5: in function 'getAreasAtPos' 18:43:41: ERROR[main]: /home/minetest/Server/bin/../mods/areas/legacy.lua:101: in function 'HasOwner' 18:43:41: ERROR[main]: ...inetest/Server/bin/../mods/plantlife/plants_lib/init.lua:448: in function 'node_is_owned' 18:43:41: ERROR[main]: ...etest/Server/bin/../mods/plantlife/flowers_plus/init.lua:97: in function <...etest/Server/bin/../mods/plantlife/flowers_plus/init.lua:74> In thread b693a220: /home/minetest/Server/src/main.cpp:1870: int main(int, char**): Assertion '0' failed. Debug stacks: DEBUG STACK FOR THREAD b20ff440: #0 virtual void* CurlFetchThread::Thread() DEBUG STACK FOR THREAD b693a220: #0 int main(int, char**) (Leftover data: #1 Dedicated server branch) (Leftover data: #2 virtual void ServerMap::save(ModifiedState)) (Leftover data: #3 virtual void Database_SQLite3::saveBlock(MapBlock*)) (Leftover data: #4 void ItemStack::serialize(std::ostream&) const) Aborted ``` I did not test that yet, will comment again here when tested.
This commit is contained in:
parent
bfb260d181
commit
c876179024
16
api.lua
16
api.lua
@ -2,13 +2,15 @@
|
||||
-- Returns a list of areas that include the provided position
|
||||
function areas:getAreasAtPos(pos)
|
||||
local a = {}
|
||||
local px, py, pz = pos.x, pos.y, pos.z
|
||||
for id, area in pairs(self.areas) do
|
||||
local ap1, ap2 = area.pos1, area.pos2
|
||||
if px >= ap1.x and px <= ap2.x and
|
||||
py >= ap1.y and py <= ap2.y and
|
||||
pz >= ap1.z and pz <= ap2.z then
|
||||
a[id] = area
|
||||
if pos then
|
||||
local px, py, pz = pos.x, pos.y, pos.z
|
||||
for id, area in pairs(self.areas) do
|
||||
local ap1, ap2 = area.pos1, area.pos2
|
||||
if px >= ap1.x and px <= ap2.x and
|
||||
py >= ap1.y and py <= ap2.y and
|
||||
pz >= ap1.z and pz <= ap2.z then
|
||||
a[id] = area
|
||||
end
|
||||
end
|
||||
end
|
||||
return a
|
||||
|
Loading…
Reference in New Issue
Block a user