Im trying to add pictured menu ,but it gives me error.Error, .lua
function loadPlayerInventory()
TBCore.Functions.TriggerServerCallback('tb-inventory:server:getPlayerInventory', function(data)
items =
inventory = data.inventory
weapons = data.weapons
local weight = 0
if inventory ~= nil then
for k, v in pairs(inventory) do
table.insert(items, inventory[k])
weight = weight + (inventory[k].amount * inventory[k].weight)
end
should give you an error
"unexpected symbol near =So you should not even get to that point that your callback is called.You forgot to assign a value to items. Your code suggests that it should be a table.
The error in the screenshot is caused by indexing data, a local nil value.
This is because your callback is called but no parameter
datais given. Find out why or make sure you don't index it if it is nil.Something like
or
for example