Got this error ERROR: "systemforfaction line 800": attempt to compare number with nil
local mostRecentWeek = 0
local currentWeek = 0
if query then
while true do
row = mysql:fetch_assoc(query)
if not row then break end
local id = tonumber(row["id"])
local amount = tonumber(row["amount"])
local time = row["newtime"]
local week = tonumber(row["week"])
currentWeek = tonumber(row["currentWeek"])
[i]this line[/i][b]if (week) > mostRecentWeek then mostRecentWeek = week end
[/b] if not transactions[week] then transactions[week] = {} end
local type = tonumber(row["type"])
local reason = row["reason"]
if reason == mysql_null() then
reason = ""
end
local from, to = "-", "-"
if row["characterfrom"] ~= mysql_null() then
from = row["characterfrom"]:gsub("_", " ")
elseif tonumber(row["from"]) then
num = tonumber(row["from"])
if num < 0 then
from = getTeamName(exports.pool:getElement("team", -num)) or "-"
elseif num == 0 and ( type == 6 or type == 7 ) then
from = "Government"
end
end
if row["characterto"] ~= mysql_null() then
to = row["characterto"]:gsub("_", " ")
elseif tonumber(row["to"]) and tonumber(row["to"]) < 0 then
to = getTeamName(exports.pool:getElement("team", -tonumber(row["to"])))
end
if tostring(row["from"]) == tostring(-factionID) and amount > 0 then
amount = amount - amount - amount
end
table.insert(transactions[week], { id = id, amount = amount, time = time, type = type, from = from, to = to, reason = reason, week = week })
--outputDebugString("transactions["..tostring(week).."]="..tostring(#transactions[week]))
end
I dont know what wrong i'm new to Scripting lua i just pickup ressource and look how its work.