1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | function localGroup:addItem(item) local i for i = 1, maxItems do print(i) -- prints 1 through 6 (maxItems = 6) if items[i] == nil then items[i] = item db:exec([[REPLACE INTO inventory (slot, itemId, description, quantity, inuse, icon, width, height, location) VALUES (]] .. i .. [[,"]] .. items[i].id .. [[","]] .. items[i].name .. [[","]] .. "1" .. [[","]] .. "1" .. [[","]] .. items[i].availableIcon .. [[","]] .. items[i].width .. [[","]] .. items[i].height .. [[","]] .. "pack" ..[[");]]) break; end end print(i) -- prints "nil" print(maxItems) if i > maxItems then return false end -- errors here because its nil return true end |
Hi Rob,
Wouldn`t be at line 6 "~=" instead of the actual "==" youre using?
Regards,