comparison Modules/Api.lua @ 73:cd00b87fad31

Fixed a bug in IAapi.RegisterCraftingDecider and added a parameter so registered deciders can provide their own options group.
author Asa Ayers <Asa.Ayers@Gmail.com>
date Thu, 29 Jul 2010 22:29:47 -0700
parents 3930518cb8d9
children 63823b6b5e28
comparison
equal deleted inserted replaced
72:8e9beb8a0330 73:cd00b87fad31
21 queue one of every item that is profitable. If you simply wanted to increase that to 5 of every 21 queue one of every item that is profitable. If you simply wanted to increase that to 5 of every
22 profitable item you could use this: 22 profitable item you could use this:
23 23
24 IAapi.RegisterCraftingDecider('Five', function() return 5 end) 24 IAapi.RegisterCraftingDecider('Five', function() return 5 end)
25 ]] 25 ]]
26 function IAapi.RegisterCraftingDecider(name, decider) 26 function IAapi.RegisterCraftingDecider(name, decider, optionsTable)
27 assert(type(name) == 'string', 'name must be a string to identify your addon. This will be displayed to the user.') 27 assert(type(name) == 'string', 'name must be a string to identify your addon. This will be displayed to the user.')
28 assert(type(destination) == 'function', 'decider must be a function.') 28 assert(type(decider) == 'function', 'decider must be a function.')
29 Crafting.RegisterCraftingDecider(name, decider) 29 assert(optionsTable == nil or type(optionsTable) == 'table')
30 Crafting.RegisterCraftingDecider(name, decider, optionsTable)
30 end 31 end
31 32
32 function IAapi.RegisterQueueDestination(name, destination) 33 function IAapi.RegisterQueueDestination(name, destination)
33 assert(type(name) == 'string', 'name must be a string to identify your addon. This will be displayed to the user.') 34 assert(type(name) == 'string', 'name must be a string to identify your addon. This will be displayed to the user.')
34 assert(type(destination) == 'function', 'destination must be a function that will be called for each item when exporting the queue.') 35 assert(type(destination) == 'function', 'destination must be a function that will be called for each item when exporting the queue.')