Script integration
Client exports

Client Exports

Misc

ToggleFlashlight

Toggle the flashlight on the tablet.

---@param enabled boolean
exports["lb-tabet"]:ToggleFlashlight(enabled)

FactoryReset

Reset the tablet to its factory settings.

exports["lb-tabet"]:FactoryReset()

ToggleOpen

Toggle the tablet's open state. If you don't send open, it will close or open the tablet depending on its current state.

---@param open? boolean
exports["lb-tabet"]:ToggleOpen(open)

Custom apps

We recommend using our custom apps template (opens in a new tab) to create custom apps.

AddCustomApp

---@class CustomApp
---@field identifier string # A unique identifier for the app
---@field name string # The name of the app
---@field description string?
---@field icon string?
---@field defaultApp boolean?
---@field price number?
---@field images table?
---@field developer string?
---@field size number?
---@field ui string?
---@field landscape boolean?
 
---@param app CustomApp
exports["lb-tabet"]:AddCustomApp({
    identifier = "custom-app",
    name = "Custom App",
    description = "This is a custom app",
    icon = "/ui/app.png",
    ui = "ui/index.html"
})

RemoveCustomApp

Remove a custom app. Only the resource that created the app can remove it.

---@param identifier string
exports["lb-tabet"]:RemoveCustomApp("custom-app")

SendCustomAppMessage

Used to send a message to a custom app.

---@param identifier string
---@param event string
---@param data any
exports["lb-tabet"]:SendCustomAppMessage("custom-app", "event", { data = true })

The ui can listen for messages using globalThis.useNuiEvent(event, callback). See lb-tablet-vanillajs/ui/script.js:90 (opens in a new tab) for an example

Components

SetPopUp

---@class PopUpInput
---@field minCharacters? number
---@field maxCharacters? number
---@field onChange? fun(value: string) | number
 
---@class PopUpTextArea
---@field minCharacters? number
---@field maxCharacters? number
---@field onChange? fun(value: string) | number
 
---@class PopUpButton
---@field title string
---@field cb? fun() | number
---@field disabled? boolean
---@field bold? boolean
---@field color? "red" | "blue"
 
---@class PopUpData
---@field id number
---@field title string
---@field description string
---@field buttons PopUpButton[]
---@field attachment? { src: string }
---@field vertical? boolean
---@field inputs? PopUpInput[]
---@field textareas? PopUpTextArea[]
---@field close? fun()
 
---@param data PopUpData
exports["lb-tabet"]:SetPopUp(data)

SetContextMenu

---@class ContextMenuButton
---@field title string
---@field cb? fun() | number
---@field color? "red" | "blue"
---@field disabled? boolean
 
---@class ContextMenu
---@field id number
---@field title? string
---@field buttons ContextMenuButton[]
---@field close? fun()
 
---@param data ContextMenu
exports["lb-tabet"]:SetContextMenu(data)

Gallery

---@class PhotoData
---@field id number
---@field src string
---@field timestamp? number
---@field type? "string"
---@field favourite? boolean
---@field isVideo? boolean
---@field size? number
---@field duration? number
 
---@class GalleryData
---@field id number
---@field includeVideos? boolean
---@field includeImages? boolean
---@field allowExternal? boolean
---@field multiSelect? boolean
---@field onSelect fun(data: PhotoData | PhotoData[]) | number
---@field close? fun()
 
---@param data GalleryData
exports["lb-tabet"]:Gallery(data)

ColorPicker

---@class ColorPickerData
---@field id number
---@field defaultColor? string
---@field onSelect fun(color: string) | number
---@field onClose? fun(color: string) | number
---@field close? fun()
 
---@param data ColorPickerData
exports["lb-tabet"]:ColorPicker(data)

Dispatch

ToggleDispatchVisible

---@param visible boolean
exports["lb-tabet"]:ToggleDispatchVisible(true)

IsDispatchVisible

---@return boolean
local visible = exports["lb-tabet"]:IsDispatchVisible()