Jump to content

element parent resourceRoot


Fabioxps

Recommended Posts

Posted

it is possible to define this parent
 

setElementParent(player,resourceRoot) --server



addCommandHandler("a",function()
    for id, element in pairs(getElementChildren(resourceRoot)) do
        outputChatBox(type(element))-- not return
    end
end)

 

Posted (edited)

when I use an Event trigger this player will also receive this call 

I do not want to create a new element and I also do not want to use a loop to get players

Edited by Fabioxps
Posted

I would strongly suggest you to avoid using that. Instead, you can create a dummy element and set it as parent for players that you wish to retrieve later using getElementChildren.

local moderatorElement = createElement( "moderator", "admin" )
if moderatorElement then
    for _, v in pairs ( getElementsByType ( "player" ) ) do 
        setElementParent ( v, moderatorElement )
    end
end

addCommandHandler("a",
function()
    for id, element in pairs ( getElementChildren ( moderatorElement ) ) do
        outputChatBox ( type ( element ) )
    end
end
)

 

  • Thanks 1

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...