• 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!
  • If you're using Gesior 2012 or MyAAC, please review this thread for information about a serious security vulnerability and a fix.

what is faster in execution time [getSpectators function or 3 for loops to check around tiles]

Shadow_

Veteran OT User
Joined
Jun 2, 2018
Messages
1,016
Solutions
31
Reaction score
429
hello,

i was wondering which can be faster execution wise using getspectators function or this code
Lua:
                        for x = positionPlayer.x - distance, positionPlayer.x + distance do
                            for y = positionPlayer.y - distance, positionPlayer.y + distance do
                                for z = positionPlayer.z, positionPlayer.z do
                                    local tileP = Tile(x, y, z)
                                    if tileP then
                                        local creatureP = tileP:getTopCreature()
                                        if creatureP and creatureP:isPlayer() then
                                            for xx = 1, #names do
                                                if creatureP:getName() == names[xx] then
                                                    posOfPlayer[#posOfPlayer+1] = creatureP
                                                end
                                            end
                                        end
                                    end
                                end
                            end
                        end
 
Top