Difference between revisions of "API CheckStorageAndUnloadCargo"

From Vendetta Lua
Jump to: navigation, search
 
(3 intermediate revisions by the same user not shown)
Line 2: Line 2:
 
| name        = CheckStorageAndUnloadCargo
 
| name        = CheckStorageAndUnloadCargo
 
| desc        = Unload cargo items and quantities according to the provided table also checks station storage and pops up a dialog if not enough available
 
| desc        = Unload cargo items and quantities according to the provided table also checks station storage and pops up a dialog if not enough available
| arg1_name   = itemid
+
| arg1_type   = table
| arg1_type   = number
+
| arg1_desc   = <nowiki>{{number itemid, number quantity} ..}</nowiki><br>
| arg1_desc    = [[itemid]] of cargo item
+
''itemid'' = [[itemid]] of cargo item<br>
| arg2_name    = quantity
+
''quantity'' = amount of this cargo to unload
| arg2_type    = number
+
| arg2_name   = cb
| arg2_desc    = amount of this cargo to unload
+
| arg2_type   = function
| arg3_name   = cb
+
| arg2_desc   = optional function to call on success
| arg3_type   = function
+
| arg2_opt     = true
| arg3_desc   = optional function to call on success
+
| arg3_opt     = true
+
 
| ret1_type    = nil
 
| ret1_type    = nil
 
| notes        = '''Example:'''<br>
 
| notes        = '''Example:'''<br>
<source lang="lua">CheckStorageAndUnloadCargo{{itemid=1234, quantity=2}, {itemid=1235, quantity=3}}</source><br>
+
<source lang="lua">CheckStorageAndUnloadCargo{{itemid=1234, quantity=2}, {itemid=1235, quantity=3}}</source>
 
unload 2 units of the cargo with the itemid 1234 and 3 with the id 1235
 
unload 2 units of the cargo with the itemid 1234 and 3 with the id 1235
 
}}
 
}}

Latest revision as of 01:42, 20 October 2011

CheckStorageAndUnloadCargo

Definition

CheckStorageAndUnloadCargo( table [,  function  cb ]) ->  nil
Description

Unload cargo items and quantities according to the provided table also checks station storage and pops up a dialog if not enough available
Arguments

Type Name Description
table {{number itemid, number quantity} ..}

itemid = itemid of cargo item

quantity = amount of this cargo to unload
function cb optional function to call on success (optional)
Returns

Type Name Description
nil
Notes

Example:

CheckStorageAndUnloadCargo{{itemid=1234, quantity=2}, {itemid=1235, quantity=3}}

unload 2 units of the cargo with the itemid 1234 and 3 with the id 1235