Files
ox_lib/resource/interface/client/textui.lua

42 lines
818 B
Lua
Raw Normal View History

---@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
2022-04-11 15:59:18 +02:00
function lib.showTextUI(text, options)
if currentText == text then return end
2022-04-11 15:59:18 +02:00
if not options then options = {} end
2022-04-11 15:59:18 +02:00
options.text = text
currentText = text
2022-04-11 15:59:18 +02:00
SendNUIMessage({
action = 'textUi',
data = options
})
isOpen = true
2022-04-11 15:59:18 +02:00
end
function lib.hideTextUI()
SendNUIMessage({
action = 'textUiHide'
})
isOpen = false
currentText = nil
end
---@return boolean
function lib.isTextUIOpen()
return isOpen
end