Drakath Posted June 8, 2014 Share Posted June 8, 2014 I have two elements with the same ID. As stated in wiki it only returns the first element. Is there a way to retrieve the second element? Link to comment
Den. Posted June 8, 2014 Share Posted June 8, 2014 Read the function's arguments on the wiki. You can specify the index of the element you want to retrieve. getElementByID(element, 1) You can also get all elements who have the same type and same ID, and put them in a table. function getElementsByID(etype, id) if etype and id then local elements = getElementsByType(etype) local result = {} for key, element in ipairs(elements) do if getElementID(element) == id then table.insert(result, element) end end return result end return false end 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