Inventory

From Blue Mars Developer Guidebook

Jump to: navigation, search
There are security restrictions on this article

Class Methods

CheckInventory(items_table, callback)
checks if the local user has specified items. Where items_table is a table which contains one or more item IDs. callback function is called when the client gets result data from the server. callback is called with a table which maps an item id to a boolean value.


Example:
Inventory.CheckInventory ({"00040032", "00040000"},
                          function (tbl)
                            for id, flag in pairs (tbl) do
                              System.Log ((flag and "You have " or "You don't have ") .. id)
                            end
                          end)
Then, you get something like this in the log output:
<Lua> You don't have 00040000
<Lua> You have 00040032


Testing
Testing of this function should be done in the client (BlueMars>Export>Check city in BlueMars from the Editor), rather than in the Editor. To avoid errors in the Editor, check if System.IsEditor() before calling this function.
Problems with this wiki page? Contact us either by: Support Email or Support Ticket System

Blue Mars Guidebook Privacy Policy
Blue Mars Guidebook Community Guidelines

Personal tools