47 posts
Posted 07 October 2012 - 04:18 PM
Hi, I writing program using ARP addon for crafting thinks and its going to be very long, when I want to add one item, I must scroll and scroll up and down, is the way to split this on some, for example, apis? This is my code
http://pastebin.com/i9mwNZ1J . This is maybe not something owesome but it works :D/>/>
1604 posts
Posted 07 October 2012 - 04:38 PM
Well, you could put all the items in an api, so they are in a separate file. Then, for the crafting function, using a table would shorten the code a lot, something like:
local tCraft = {
["Furnace"] = piecrec,
["Copper Cable"] = copcablerec,
-- etc.
}
local function crafting(:D/>/>
if tCraft[b] then
craftuj(tCraft[b])
else
surowce(;)/>/>
end
end
-- to call:
crating("Furnace")
2088 posts
Location
South Africa
Posted 07 October 2012 - 05:10 PM
Well, you could put all the items in an api, so they are in a separate file. Then, for the crafting function, using a table would shorten the code a lot, something like:
-- to call:
crating("Furnace")
crafting*? :D/>/>
47 posts
Posted 07 October 2012 - 06:47 PM
Thank You very much. This is what I want :D/>/>