of     1   

TheBoyOnTheBlock
#138540052Saturday, June 28, 2014 9:26 PM GMT

Excuse me, but how would I check the name of a value in a table? Could you give me an example?
youssef04
#138540213Saturday, June 28, 2014 9:28 PM GMT

table = {"bob", "hi", "lol"} for i,v in pairs (table) do wait(1) print(v) end PRINT: --bob --hi --lol
TheBoyOnTheBlock
#138540377Saturday, June 28, 2014 9:29 PM GMT

No. I meant in an if statement. Like: if v.Name == "blah" then
TheBoyOnTheBlock
#138540752Saturday, June 28, 2014 9:33 PM GMT

Bump
secretidagent
#138541004Saturday, June 28, 2014 9:35 PM GMT

@youssef04 Naming a table, "table" is a bad idea. -------------------- @OP list = {"Apples","Bananas",true,false} if list[2] == "Bananas" then print("Bananas are at list[2] inside the table \'list\'") end
CynicalBusiness
#138541005Saturday, June 28, 2014 9:35 PM GMT

yourtable = {"some", "values", "foo", "bar"} function isInTable(tb, value) for _,v in pairs(tb) do wait(); if (v==value) then return true; end; end return false; end print(isInTable(yourtable, "some").." : "..isInTable(yourtable, "foobar")); > "true : false" That should do it. Just put the function somewhere.
TheBoyOnTheBlock
#138541335Saturday, June 28, 2014 9:38 PM GMT

Could you guys code it into this? My head hurts from having to do some hacky crap in the other blocks of code: function removeItem(y) currentItems = #inventory if (currentItems < 1) then print('Nothing to remove') else for i = 1, currentItems do if i == y then table.remove(inventory, i) print('Item removed.') break end end currentItems = #inventory end end
secretidagent
#138541612Saturday, June 28, 2014 9:41 PM GMT

function removeItem(y) currentItems = #inventory if (currentItems < 1) then print('Nothing to remove') else for i = 1, currentItems do if currentItems[i] == y then table.remove(inventory, i) print('Item removed.') break end end currentItems = #inventory end end
TheBoyOnTheBlock
#138553181Saturday, June 28, 2014 11:27 PM GMT

Oh yeah, I forgot. currentItems is a number value.
TheBoyOnTheBlock
#138553465Saturday, June 28, 2014 11:30 PM GMT

Damn, I'm seriously stumped.
TheBoyOnTheBlock
#138553647Saturday, June 28, 2014 11:32 PM GMT

:D I fixed it! Open source YAYAYAYAYAYAYA!: inventory = {} maxItems = 10 -- change this to how many items you can store currentItems = #inventory function addItem(x) currentItems = #inventory if (currentItems < maxItems) then local item = table.insert(inventory, (currentItems + 1), x) print(x.. ' added') currentItems = #inventory else print('Inventory already full.') end end function removeItem(y) currentItems = #inventory if (currentItems < 1) then print('Nothing to remove') else for i = 1, #inventory do if inventory[i] == y then table.remove(inventory, i) print(y.. ' removed.') break end end currentItems = #inventory end end addItem("sword") addItem("axe") removeItem("axe") print(table.concat(inventory, ' '))
Goulstem
#138554784Saturday, June 28, 2014 11:43 PM GMT

tble = {"derp","hi",tostring(lel),"abc"} if table.concat(table):match(something.Name:lower()) then print("Yusss") end --scripz go fatstar if'd table.concat
TheBoyOnTheBlock
#138555472Saturday, June 28, 2014 11:49 PM GMT

print'YUSILICIOUS'
Goulstem
#138555579Saturday, June 28, 2014 11:50 PM GMT

Ur cool
TheBoyOnTheBlock
#138555978Saturday, June 28, 2014 11:53 PM GMT

Ur kewl tew <3

    of     1