LGF Utility
Ui Class
Text UI

Text UI

Manage Text UI elements in your application using client-side methods. This documentation outlines how to handle Text UI effectively.


Image
Image

OpenTextUI

  • Use the exports OpenTextUI function to display a Text UI element:
exports["LGF_Utility"]:OpenTextUI(data)

The TextUIData table data for displaying the Text UI should contain the following fields:

  • title: (string) The title of the Text UI (optional).
  • message: (string) The message to display (required).
  • colorProgress: (string) The color of the loader (optional).
  • keyBind: (string) The keybind to display (optional; shown only if useKeybind is true).
  • position: (string) The position of the Text UI (default is "center-right").
  • useKeybind: (boolean) Whether to show the keybind (optional).
  • useProgress: (boolean) Whether to show the loader (optional).

Example Usage

exports["LGF_Utility"]:OpenTextUI({
    title = "Information",  -- Optional title for the Text UI
    message = "Loading data, please wait...",
    colorProgress = "rgba(54, 156, 129, 0.381)",
    keyBind = "F",  -- Optional keybind to display
    position = "center-right",  -- Position of the Text UI
    useKeybind = true,  -- Show the keybind (optional)
    useProgress = false   -- Show the loader (optional)
})

DisableTextUI

Use the exports CloseTextUI function to hide the Text UI element:

exports["LGF_Utility"]:CloseTextUI()

Example Usage

if exports["LGF_Utility"]:GetStateTextUI() then
    exports["LGF_Utility"]:CloseTextUI()
end

GetStateTextUI

Use the exports GetStateTextUI function to check if the Text UI is currently open:

exports["LGF_Utility"]:GetStateTextUI()

Return Value:

  • state: (boolean) Returns true if the Text UI is currently open, and false if it is closed.

Example Usage

local isOpen = exports["LGF_Utility"]:GetStateTextUI()
if isOpen then
    print("TextUI is open")
else
    print("TextUI is closed")
end