Script: trouble with tables.
Posted: Sat Oct 06, 2012 6:49 pm
So, I created a table of tables for my merchant script:
but when I try to cycle through the tables one by one, with the click of a button, with this function:
it cycles through all the items. i don't know how to use the counter to cycle through objects one by one.
Any help please ?
Code: Select all
function setUpItems()
ItemOptions = {
{Item="dagger",sellPrice=0.5,buyPrice=5},
{Item="cutlass",sellPrice=0.7,buyPrice=7},
{Item="fist_dagger",sellPrice=0.7,buyPrice=10},
{Item="flail",sellPrice=1,buyPrice=15},
{Item="great_axe",sellPrice=2,buyPrice=25},
{Item="hand_axe",sellPrice=0.7,buyPrice=6},
{Item="knife",sellPrice=0.4,buyPrice=4},
{Item="long_sword",sellPrice=0.7,buyPrice=13},
{Item="machete",sellPrice=0.6,buyPrice=10},
{Item="shuriken",sellPrice=0.3,buyPrice=10},
{Item="throwing_axe",sellPrice=0.2,buyPrice=8},
{Item="throwing_knife",sellPrice=0.2,buyPrice=8},
endCode: Select all
function changeItem()
setUpItems()
local counterItem = merchant_item_type_counter_1:getValue()
for i,option in pairs(ItemOptions) do
hudPrint(" A "..option.Item.." to buy for "..option.buyPrice.." gold coins.")
end
endAny help please ?