FlyingSpoon Posted February 5, 2018 Share Posted February 5, 2018 (edited) attempt to index field '?' (a string value) for ID, Arena in ipairs(arenas) do Arena[1].Element = createElement("Arena", Arena[1]); end The element name should be unique, since there's around 8 elements I need to create. Edited February 5, 2018 by ℓιgнт Link to comment
NeXuS™ Posted February 5, 2018 Share Posted February 5, 2018 (edited) Check if Arena[1] is a table. outputChatBox(type(Arena[1])) Edited February 5, 2018 by NeXuS™ Link to comment
FlyingSpoon Posted February 5, 2018 Author Share Posted February 5, 2018 Outputs String Link to comment
NeXuS™ Posted February 5, 2018 Share Posted February 5, 2018 (edited) Then Arena[1] isn't a table, therefore, can't be indexed. Edited February 5, 2018 by NeXuS™ Link to comment
FlyingSpoon Posted February 5, 2018 Author Share Posted February 5, 2018 So how would I go about making a unique index for all my 9 elements, e.g. local arenas = { {"Arena1"}, {"Arena2"}, {"Arena3"}, {"Arena4"}, ... } for i, v in ipairs(arenas) do uniqueValue?? = createElement(...) end Link to comment
NeXuS™ Posted February 5, 2018 Share Posted February 5, 2018 local arenas = { {"Arena1"}, {"Arena2"}, {"Arena3"}, {"Arena4"}, } for i, v in ipairs(arenas) do arenas[i]["Element"] = createElement(...) end Try it like this. Link to comment
FlyingSpoon Posted February 5, 2018 Author Share Posted February 5, 2018 Works like charm, cheers. - Closed 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