From the reference libraryRedM

examples

jo_libs/modules/prompts/prompt/autodoc/slots/examples.md

examples

Example

local group = "interaction"
local keyLabel = "The key"
local key = "INPUT_JUMP"
local duration = 1000
jo.prompt.create(group, keyLabel, key, duration)

Example

local group = "interaction"
local key = "INPUT_JUMP"
jo.prompt.deletePrompt(group, key)

Example

local group = "interaction"
local keyLabel = "The key"
local key = "INPUT_JUMP"
local duration = 1000
jo.prompt.create(group, keyLabel, key, duration)
jo.prompt.deleteAllGroups()
print(jo.prompt.isGroupExist('interaction'))
-- Expected output : false

Example

local group = "shop"
jo.prompt.deleteGroup(group)

Example

CreateThread(function()
  local group = "shop"
  local title = "Stable shop"
  local keyLabel = "The key"
  local key = "INPUT_JUMP"
  jo.prompt.create(group, keyLabel, key)
  while true do
    jo.prompt.displayGroup(group, title)
    Wait(0)
  end
end)

Example

local group = "shop"
local key = "INPUT_ENTER"
print(jo.prompt.doesLastCompletedIs(group, key))

Example

local group = "shop"
local key = "INPUT_JUMP"
local label = "The new label"
jo.prompt.editKeyLabel(group, key, label)

Example

local group = "shop"
local key = "INPUT_JUMP"
print(jo.prompt.get(group, key))

Example

local groups = jo.prompt.getAll
log(groups)

Example

local groupName = "MyGroup"
local group = jo.prompt.getGroup(groupName)
log(group)

Example

local groupName = "MyGroup"
local page = jo.prompt.getPage(groupName)
log(page)

Example

local group = "interaction"
local keyLabel = "The key"
local key = "INPUT_JUMP"
jo.prompt.create(group, keyLabel, key)
CreateThread(function()
  while true do
    print(jo.prompt.getProgress(group, key))
    Wait(0)
  end
end)

Example

local group = "interaction"
local keyLabel = "The key"
jo.prompt.isActive(group, key)
-- Expected output : false

Example

CreateThread(function()
  local group = "interaction"
  local keyLabel = "The key"
  local key = "INPUT_JUMP"
  local duration = 1000
  jo.prompt.create(group, keyLabel, key, duration)
  while true do
    if jo.prompt.isCompleted(group, key) then
      print('Key completed !')
    end
    jo.prompt.displayGroup(group, title)
    Wait(0)
  end
end)

Example

local group = "interaction"
local keyLabel = "The key"
jo.prompt.isEnabled(group, key)
-- Expected output : false

Example

local group = "interaction"
local keyLabel = "The key"
local key = "INPUT_JUMP"
jo.prompt.create(group, keyLabel, key)
print(jo.prompt.isPromptExist('interaction', 'INPUT_JUMP'))
-- Expected output : true
print(jo.prompt.isGroupExist('new_group', 'INPUT_RELOAD'))
-- Expected output : false

Example

local group = "interaction"
local keyLabel = "The key"
local key = "INPUT_JUMP"
jo.prompt.create(group, keyLabel, key)
print(jo.prompt.isGroupExist('interaction'))
-- Expected output : true
print(jo.prompt.isGroupExist('new_group'))
-- Expected output : false

Example

local key = "INPUT_FRONTEND_ACCEPT"
print(jo.prompt.isPressed(key))

Example

local group = "shop"
local key = "INPUT_JUMP"
local isVisible = jo.prompt.isVisible(group, key)
log(isVisible)

Example

local group = "shop"
local key = "INPUT_JUMP"
jo.prompt.setEnabled(group, key, false)

Example

local groups = exports.resourceName:getPrompt()
jo.prompt.setGroups(groups)

Example

local group = "shop"
local key = "INPUT_JUMP"
local isVisible = false
jo.prompt.setVisible(group, key, isVisible)

Example

CreateThread(function()
  local group = "interaction"
  local keyLabel = "The key"
  local key = "INPUT_JUMP"
  local duration = 1000
  jo.prompt.create(group, keyLabel, key, duration)
  while true do
    if jo.prompt.isCompleted(group, key) then
      print('Key completed !')
      jo.prompt.waitRelease(key)
      print('Key released !')
    end
    jo.prompt.displayGroup(group, title)
    Wait(0)
  end
end)

Back to documentation