DgsMenuGetItemText: Difference between revisions
Jump to navigation
Jump to search
(Created page with "{{Client function}} __NOTOC__ This function retrieves the displayed text of a menu item. ==Syntax== <syntaxhighlight lang="lua"> string dgsMenuGetItemText ( element menu, int uniqueID ) </syntaxhighlight> ===Required Arguments=== *'''menu:''' The DGS menu element containing the item *'''uniqueID:''' The unique ID of the menu item (returned by dgsMenuAddItem) ===Returns=== Returns the text string if successful, ''false'' if the item doesn't exist. ==Examples== <sy...") |
No edit summary |
||
Line 45: | Line 45: | ||
==Author== | ==Author== | ||
[[User:Mohab|Mohab]]. | [[User:Mohab|Mohab]]. | ||
Latest revision as of 04:52, 10 July 2025
This function retrieves the displayed text of a menu item.
Syntax
string dgsMenuGetItemText ( element menu, int uniqueID )
Required Arguments
- menu: The DGS menu element containing the item
- uniqueID: The unique ID of the menu item (returned by dgsMenuAddItem)
Returns
Returns the text string if successful, false if the item doesn't exist.
Examples
loadstring(exports.dgs:dgsImportFunction())()-- load functions -- Create a menu with some items local menu = dgsCreateMenu(200, 200, 150, 100, false) local item1 = dgsMenuAddItem(menu, "New Game", "new") local item2 = dgsMenuAddItem(menu, "Load Game", "load") local item3 = dgsMenuAddItem(menu, "Exit", "exit") -- Show the menu dgsMenuShow(menu) -- Get and display the text of menu items local text1 = dgsMenuGetItemText(menu, item1) local text2 = dgsMenuGetItemText(menu, item2) local text3 = dgsMenuGetItemText(menu, item3) outputChatBox("Menu items: " .. text1 .. ", " .. text2 .. ", " .. text3) -- Output: "Menu items: New Game, Load Game, Exit"