Jump to content

getElementByID


Drakath

Recommended Posts

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...