title: Is there a way to check for the value in the table.insert in LUA?
body: <p>So i am wrighting a script for a FiveM server and i have a question. I am kinda new to LUA so keep that in mind. As far as I understand this line of code does this, It checks if the items on the invetory are greater than 0 and then it inserts the x item. The problem is that the player can insert much more items than it has on the inventory. What i mean by that? The player has 10 chocolates but he can add 20 on the table. Is there a way to check how many items he wants to put then check his inventory and then add it to the table? Here is the lines of code that do that.</p>
  <pre><code>local elements = {}
  
     for i=1, #inventory.items, 1 do
  
       local item = inventory.items[i]
  
       if item.count &gt; 0 then
         table.insert(elements, {label = item.label .. ' x' .. item.count, type = 'item_standard', value = item.name})
       end
  
     end
  </code></pre>