• 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 Script Error [GlobalEvent Interface] attempt to call global 'isInArray' (a nil value) after starting the engine [TFS 1.2] [Tibia 10.98]

Haskys

Member
Joined
Jul 19, 2019
Messages
97
Reaction score
8
Location
Poland
Hello,


After starting the engine, TFS 1.2 receives the following error every 2 seconds:

Code:
Lua Script Error: [GlobalEvent Interface]
data/globalevents/scripts/wrath of the emperor quest/spyHoles.lua:onThink
...alevents/scripts/wrath of the emperor quest/spyHoles.lua:19: attempt to call global 'isInArray' (a nil value)
stack traceback:
        [C]: in function 'isInArray'
        ...alevents/scripts/wrath of the emperor quest/spyHoles.lua:19: in function <...alevents/scripts/wrath of the emperor quest/spyHoles.lua:11>
[Error - GlobalEvents::think] Failed to execute event: WotESpyHoles

Script:
data/globalevents/scripts/wrath of the emperor quest/spyHoles.lua

Lua:
local positions = {
    Position(33385, 31139, 8),
    Position(33385, 31134, 8),
    Position(33385, 31126, 8),
    Position(33385, 31119, 8),
    Position(33385, 31118, 8),
    Position(33380, 31085, 8),
    Position(33380, 31093, 8)
}

function onThink(interval, lastExecution)
    if math.random(100) < 50 then
        return true
    end

    local item
    for i = 1, #positions do
        item = Tile(positions[i]):getThing(1)
        if item and isInArray({12213, 12214}, item.itemid) then
            item:transform(item.itemid == 12213 and 12214 or 12213)
        end
    end

    return true
end


Please help.

Haskys
 
Solution
Try adding this line into compat.lua (somewhere near the bottom I guess)
Lua:
function isInArray(array, value) return table.contains(array, value) end

If that doesn't work, remove that line, and add this code below into compat.lua
Lua:
table.contains = function(array, value)
    for _, targetColumn in pairs(array) do
        if targetColumn == value then
            return true
        end
    end
    return false
end

isInArray = table.contains
Try adding this line into compat.lua (somewhere near the bottom I guess)
Lua:
function isInArray(array, value) return table.contains(array, value) end

If that doesn't work, remove that line, and add this code below into compat.lua
Lua:
table.contains = function(array, value)
    for _, targetColumn in pairs(array) do
        if targetColumn == value then
            return true
        end
    end
    return false
end

isInArray = table.contains
 
Solution
Back
Top