Scripts/resources/[standalone]/ox_lib/resource/interface/client/textui.lua

41 lines
844 B
Lua
Raw Normal View History

2024-12-29 20:02:43 +00:00
---@class TextUIOptions
---@field position? 'right-center' | 'left-center' | 'top-center';
---@field icon? string | {[1]: IconProp, [2]: string};
---@field iconColor? string;
---@field style? string | table;
---@field alignIcon? 'top' | 'center';
local isOpen = false
local currentText
---@param text string
---@param options? TextUIOptions
function lib.showTextUI(text, options)
if currentText == text then return end
if not options then options = {} end
options.text = text
currentText = text
SendNUIMessage({
action = 'textUi',
data = options
})
isOpen = true
end
function lib.hideTextUI()
SendNUIMessage({
action = 'textUiHide'
})
isOpen = false
currentText = nil
end
---@return boolean, string | nil
function lib.isTextUIOpen()
return isOpen, currentText
end