在脚本上出现错误

我为游戏 Garry's Mod 创建了一个脚本,但是当它加载到一些服务器时,会出现以下错误:

[ERROR] addons/ulib-master/lua/ulib/shared/hook.lua:110: addons/applysystem/lua/applysystem/init.lua:13: bad argument #1 to 'pairs' (table expected, got nil) fn - [C]:-1 unknown - addons/ulib-master/lua/ulib/shared/hook.lua:110

我该如何解决?这是第13行:

for _, row in pairs(results[1].data) do

如有需要,以下为产生错误的整个函数:

db:Query("SELECT * FROM "..ApplySystem.MySQL.TableName.." WHERE delivered=0 AND status='Accepted.'", function(results)

        for _, row in pairs(results[1].data) do

            local steamid64 = row.steamid
            if steamid64 != "" or steamid64 != nil then

                local TransfSteamID = util.SteamIDFrom64(steamid64)
                RunConsoleCommand("ulx","adduserid",TransfSteamID,ApplySystem.MySQL.DefaultRank)
                db:Query("UPDATE "..ApplySystem.MySQL.TableName.." SET delivered=1 WHERE steamid='"..row.steamid.."'  ")
            end
        end

end)
点赞
用户5715760
用户5715760
Fixed, thanks guys, it was because i were trying to retrieve nil values.

修正了,谢谢大家,原因是因为我试图检索空值。

2016-03-10 23:45:36