Guest User

Untitled

a guest
Jun 18th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.58 KB | None | 0 0
  1. -- Destroys the given user interface (recursively), or all user interfaces if none is provided.
  2. function destroyGUI(guiNode)
  3.     if not guiNode then
  4.         guiNode = guiRoot
  5.     end
  6.    
  7.     local guiElements = getElementData(guiNode, "guiElements", false)
  8.     if type(guiElements) == "table" then
  9.         for _, guiElement in ipairs(guiElements) do
  10.             if isElement(guiElement) then
  11.                 destroyElement(guiElement)
  12.             end
  13.         end
  14.     end
  15.    
  16.     for _, subGuiNode in ipairs(getElementChildren(guiNode)) do
  17.         outputDebugString(getElementID(subGuiNode))
  18.         destroyGUI(subGuiNode)
  19.     end
  20.    
  21.     destroyElement(guiNode)
  22. end
Add Comment
Please, Sign In to add comment