LynxMods
  • Overview
  • Using Lua Scripts
    • Using lua scripts
  • DEVELOPERS
    • Writing Lua Scripts
      • Getting Started
      • Examples
        • Basic UI Examples
        • Basic Auto Reply
      • Events
      • API Documentation
        • client
        • ui
Powered by GitBook
On this page

Was this helpful?

  1. DEVELOPERS
  2. Writing Lua Scripts
  3. Examples

Basic UI Examples

PreviousExamplesNextBasic Auto Reply

Last updated 4 years ago

Was this helpful?

This is a simple lua that adds elements to the Lynx Menu

Lua Script:

ui.Modal("Hello World!", "This modal will display a toast upon click", function()
    client.showToast("Hello World!")
end)

local checkbox = ui.Checkbox("Auto Meme", "Repeats what the users says", "auto_meme", false);

--[[ 
You can call checkbox.setValue(true); or 
checkbox.setValue(false) to force change the value of the checkbox
]]

events.addCallback("incoming_message", function(message)
    if (not checkbox.getValue()) then
        return
    end

    client.sendMessage(message.text, message.chat_jid);
end)