How would I find if a string matches a value in a table, while also seeing what tuple it is? (I believe that's the correct term. What I mean is it's 'sequence' in the table, I guess.)
Why I ask this? I'm working on a little code redemption GUI, and I need a value to be removed from a table when the player redeems a value in the table, so they can't redeem it again and again and again.
I think the term you're looking for is 'index'. A tuple is a variable-number of, well, variables. Typically upvalues for functions.
To actually answer your question, use a for loop:
local playerCodes = {'124525', 'bonanza', '125astdg'} local textEntered = '124525' for index, value in ipairs(playerCodes) do if value == textEntered then redeem(value) --Or however you handling redeeming a specific code. table.remove(playerCodes, index) end end
There are some problems that might arise by using this method, but they're all edge case and if you don't know how to do this to begin with, I doubt you'd write code that would cause those bugs.
In any case, if you have bugged code, definitely ask about it here.