Drakath Posted November 23, 2014 Share Posted November 23, 2014 I'm trying to index some stuff but I can't get it to work. I have a text which is assigned to a player. I want to check if this text is assigned. (I do not want to use account data) There can be many different texts. Here's what I tried: if pText[player] then table.insert(pText[player], {[text] = "someValue"}) else pText[player] = {[text] = "someValue") } end --I check if it is assigned like this: if pText[player][text] then doStuff() end The first text works but when it tries to assign the second text and uses table.insert, my script doesn't detect it anymore. Can anyone help me fix this? Link to comment
ixjf Posted November 23, 2014 Share Posted November 23, 2014 Your table.insert call is basically the same as: pText[player][1] = {[text] = "someValue"} which is not what you want to do. This is how it should be: pText[player][text] = "someValue" Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now