Advertisement
hhjfdgdfgdfg

Untitled

May 13th, 2024
23
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 30.29 KB | None | 0 0
  1.  
  2.  
  3. MenuV global namespace
  4. Alias: MenuV
  5.  
  6. MenuV library
  7.  
  8. MenuV#CloseMenu(MenuV, menu, callback=undefined)⇒void
  9. Type: function
  10.  
  11. Close a menu
  12.  
  13. Parameters
  14. MenuV : MenuV
  15. menu : Menu|string
  16. Menu or Universally Unique Identifier (UUID)
  17.  
  18. callback : functionundefined
  19. Trigger callback when function has been executed
  20.  
  21. Example #1
  22.  
  23. local menu = MenuV:CreateMenu('MenuV', 'Welcome to MenuV', 'topleft', 255, 0, 0, 'size-125', 'example', 'menuv', 'example_namespace', 'native')
  24. MenuV:CloseMenu(menu)
  25. Example #2
  26.  
  27. local menu = MenuV:CreateMenu('MenuV', 'Welcome to MenuV', 'topleft', 255, 0, 0, 'size-125', 'example', 'menuv', 'example_namespace', 'native')
  28. MenuV:CloseMenu(menu, function()
  29. print('Menu closed :(')
  30. end)
  31. MenuV#CreateMenu(MenuV, title='MenuV', subtitle='', position='topleft', r=0, g=0, b=255, size='size-110', texture='default', dictionary='menuv', namespace='unknown', theme='default')⇒Menu
  32. Type: function
  33.  
  34. Create a MenuV menu
  35.  
  36. Parameters
  37. MenuV : MenuV
  38. title : string|boolean'MenuV'
  39. Title that appears on the big banner.
  40.  
  41. subtitle : string''
  42. Subtitle that appears in capital letters in a small black bar.
  43.  
  44. position : string'topleft'
  45. Menu position on screen options: topleft | topcenter | topright | centerleft | center | centerright | bottomleft | bottomcenter | bottomright
  46.  
  47. r : number0
  48. Primary color RGB red channel [0-255]
  49.  
  50. g : number0
  51. Primary color RGB green channel [0-255]
  52.  
  53. b : number255
  54. Primary color RGB blue channel [0-255]
  55.  
  56. size : string'size-110'
  57. Menu size in % options: size-100 | size-110 | size-125 | size-150 | size-175 | size-200
  58.  
  59. texture : string'default'
  60. Texture name for the banner image
  61.  
  62. dictionary : string'menuv'
  63. Texture dictionary name for the banner image
  64.  
  65. namespace : string'unknown'
  66. Namespace is required to set keybinds, make sure given namespace is unique for every menu.
  67.  
  68. theme : string'default'
  69. Change the look of the menu, available options: default and native
  70.  
  71. Returns: Menu
  72.  
  73. Example #1
  74.  
  75. local menu = MenuV:CreateMenu('MenuV')
  76. Example #2
  77.  
  78. local menu = MenuV:CreateMenu('MenuV', 'Welcome to MenuV')
  79. Example #3
  80.  
  81. local menu = MenuV:CreateMenu('MenuV', 'Welcome to MenuV', 'topleft')
  82. Example #4
  83.  
  84. local menu = MenuV:CreateMenu('MenuV', 'Welcome to MenuV', 'topleft', 255, 0, 0)
  85. Example #5
  86.  
  87. local menu = MenuV:CreateMenu('MenuV', 'Welcome to MenuV', 'topleft', 255, 0, 0, 'size-125')
  88. Example #6
  89.  
  90. local menu = MenuV:CreateMenu('MenuV', 'Welcome to MenuV', 'topleft', 255, 0, 0, 'size-125', 'example')
  91. Example #7
  92.  
  93. local menu = MenuV:CreateMenu('MenuV', 'Welcome to MenuV', 'topleft', 255, 0, 0, 'size-125', 'example', 'menuv')
  94. Example #8
  95.  
  96. local menu = MenuV:CreateMenu('MenuV', 'Welcome to MenuV', 'topleft', 255, 0, 0, 'size-125', 'example', 'menuv', 'example_namespace')
  97. Example #9
  98.  
  99. local menu = MenuV:CreateMenu('MenuV', 'Welcome to MenuV', 'topleft', 255, 0, 0, 'size-125', 'example', 'menuv', 'example_namespace', 'native')
  100. MenuV#GetMenu(MenuV, uuid)⇒Menu|null
  101. Type: function
  102.  
  103. Returns created menu matching UUID
  104.  
  105. Parameters
  106. MenuV : MenuV
  107. uuid : string
  108. Universally Unique Identifier (UUID)
  109.  
  110. Returns: Menu|null — Returns matching menu or nil
  111.  
  112. Example
  113.  
  114. local menu = MenuV:GetMenu('00000000-0000-0000-0000-000000000000')
  115. MenuV#InheritMenu(MenuV, menu, overrides, namespace)⇒Menu
  116. Type: function
  117.  
  118. Create a new menu from properties of this one (without items and events)
  119.  
  120. Parameters
  121. MenuV : MenuV
  122. menu : Menu
  123. Menu to take properties from
  124.  
  125. overrides : table
  126. A table with key values to override, see Menu options
  127.  
  128. namespace : string
  129. Unique namespace, see Menu.Namespace
  130.  
  131. Returns: Menu — New menu with properties of this one
  132.  
  133. Example
  134.  
  135. local menu = MenuV:CreateMenu('MenuV', 'Welcome to MenuV', 'topleft', 255, 0, 0, 'size-125', 'example', 'menuv', 'example_namespace', 'native')
  136. local menu2 = MenuV:InheritMenu(menu, { title = 'Menu V2', subtitle = 'Welcome to MenuV2 :D', theme = 'default' })
  137. MenuV#IsNamespaceAvailable(namespace)⇒boolean
  138. Type: function
  139.  
  140. Checks if namespace is available
  141.  
  142. Parameters
  143. namespace : string
  144. Namespace, see Menu.Namespace
  145.  
  146. Returns: boolean — Return true if given namespace is available, otherwise false
  147.  
  148. Example
  149.  
  150. local available = MenuV:IsNamespaceAvailable('example_namespace')
  151. MenuV#OpenMenu(MenuV, menu, callback=undefined)⇒void
  152. Type: function
  153.  
  154. Open a menu
  155.  
  156. Parameters
  157. MenuV : MenuV
  158. menu : Menu|string
  159. Menu or Universally Unique Identifier (UUID)
  160.  
  161. callback : functionundefined
  162. Trigger callback when function has been executed
  163.  
  164. Example #1
  165.  
  166. local menu = MenuV:CreateMenu('MenuV', 'Welcome to MenuV', 'topleft', 255, 0, 0, 'size-125', 'example', 'menuv', 'example_namespace', 'native')
  167. MenuV:OpenMenu(menu)
  168. Example #2
  169.  
  170. local menu = MenuV:CreateMenu('MenuV', 'Welcome to MenuV', 'topleft', 255, 0, 0, 'size-125', 'example', 'menuv', 'example_namespace', 'native')
  171. MenuV:OpenMenu(menu, function()
  172. print('Menu is now open :D')
  173. end)
  174. ButtonItem:class global
  175. Extends: Item
  176.  
  177. Button item for MenuV
  178.  
  179. ButtonItem#event:enter
  180. Type: event
  181.  
  182. Event will be triggered when item becomes active/selected in NUI
  183.  
  184. Parameters
  185. item : Item
  186. Current active/selected item
  187.  
  188. Example
  189.  
  190. item:On('enter', function(item)
  191. print('You have entered this item :)')
  192. end)
  193. ButtonItem#event:leave
  194. Type: event
  195.  
  196. Event will be triggered when item becomes inactive/unselected in NUI
  197.  
  198. Parameters
  199. item : Item
  200. Current inactive/unselected item
  201.  
  202. Example
  203.  
  204. item:On('leave', function(item)
  205. print('You have unselected this item :(')
  206. end)
  207. ButtonItem#event:select
  208. Type: event
  209.  
  210. Event will be triggered when user pressed ENTER on item
  211.  
  212. Parameters
  213. item : ButtonItem
  214. Current selected item
  215.  
  216. Example
  217.  
  218. item:On('select', function(item)
  219. print('You have updated this item :)')
  220. end)
  221. ButtonItem#event:update
  222. Type: event
  223.  
  224. Event will be triggered when item's value changed
  225.  
  226. Parameters
  227. item : Item
  228. Current updated item
  229.  
  230. key : string
  231. Current updated key
  232.  
  233. value : any
  234. Current updated value
  235.  
  236. oldValue : any
  237. Previous value
  238.  
  239. Example
  240.  
  241. item:On('update', function(item, key, value, oldValue)
  242. print('You have updated this item :)')
  243. end)
  244. CheckboxItem:class global
  245. Extends: Item
  246.  
  247. Checkbox item for MenuV
  248.  
  249. CheckboxItem.Value:boolean static
  250. Value: false
  251.  
  252. Type: boolean
  253.  
  254. Value of CheckboxItem
  255.  
  256. CheckboxItem#event:change
  257. Type: event
  258.  
  259. Event will be triggered when user changed checkbox state
  260.  
  261. Parameters
  262. item : CheckboxItem
  263. Current changed checkbox item
  264.  
  265. newValue : boolean
  266. New state of checkbox
  267.  
  268. oldValue : boolean
  269. Previous state of checkbox
  270.  
  271. Example
  272.  
  273. item:On('change', function(item, newValue, oldValue)
  274. print('You have changed them checkbox state :)')
  275. end)
  276. CheckboxItem#event:check
  277. Type: event
  278.  
  279. Event will be triggered when user check the checkbox
  280.  
  281. Parameters
  282. item : CheckboxItem
  283. Current checked checkbox item
  284.  
  285. Example
  286.  
  287. item:On('check', function(item)
  288. print('You have set the checkbox state to checked :D')
  289. end)
  290. CheckboxItem#event:enter
  291. Type: event
  292.  
  293. Event will be triggered when item becomes active/selected in NUI
  294.  
  295. Parameters
  296. item : Item
  297. Current active/selected item
  298.  
  299. Example
  300.  
  301. item:On('enter', function(item)
  302. print('You have entered this item :)')
  303. end)
  304. CheckboxItem#event:leave
  305. Type: event
  306.  
  307. Event will be triggered when item becomes inactive/unselected in NUI
  308.  
  309. Parameters
  310. item : Item
  311. Current inactive/unselected item
  312.  
  313. Example
  314.  
  315. item:On('leave', function(item)
  316. print('You have unselected this item :(')
  317. end)
  318. CheckboxItem#event:uncheck
  319. Type: event
  320.  
  321. Event will be triggered when user uncheck the checkbox
  322.  
  323. Parameters
  324. item : CheckboxItem
  325. Current unchecked checkbox item
  326.  
  327. Example
  328.  
  329. item:On('uncheck', function(item)
  330. print('You have set the checkbox state to unchecked :(')
  331. end)
  332. CheckboxItem#event:update
  333. Type: event
  334.  
  335. Event will be triggered when item's value changed
  336.  
  337. Parameters
  338. item : Item
  339. Current updated item
  340.  
  341. key : string
  342. Current updated key
  343.  
  344. value : any
  345. Current updated value
  346.  
  347. oldValue : any
  348. Previous value
  349.  
  350. Example
  351.  
  352. item:On('update', function(item, key, value, oldValue)
  353. print('You have updated this item :)')
  354. end)
  355. ConfirmItem:class global
  356. Extends: Item
  357.  
  358. Confirm item for MenuV
  359.  
  360. ConfirmItem#Confirm()⇒void
  361. Type: function
  362.  
  363. Confirm this item, set confirm state to true
  364.  
  365. ConfirmItem#Deny()⇒void
  366. Type: function
  367.  
  368. Deny this item, set confirm state to false
  369.  
  370. ConfirmItem.Value:boolean static
  371. Value: false
  372.  
  373. Type: boolean
  374.  
  375. Value of ConfirmItem
  376.  
  377. ConfirmItem#event:change
  378. Type: event
  379.  
  380. Event will be triggered when user changed confirm state
  381.  
  382. Parameters
  383. item : ConfirmItem
  384. Current changed confirm item
  385.  
  386. newValue : boolean
  387. New state of confirm
  388.  
  389. oldValue : boolean
  390. Previous state of confirm
  391.  
  392. Example
  393.  
  394. item:On('change', function(item, newValue, oldValue)
  395. print('You have changed them confirm state :)')
  396. end)
  397. ConfirmItem#event:confirm
  398. Type: event
  399.  
  400. Event will be triggered when user confirm the ConfirmItem
  401.  
  402. Parameters
  403. item : ConfirmItem
  404. Current confirmed confirm item
  405.  
  406. Example
  407.  
  408. item:On('confirm', function(item)
  409. print('You have confirmed the confirm item :D')
  410. end)
  411. ConfirmItem#event:deny
  412. Type: event
  413.  
  414. Event will be triggered when user denied the ConfirmItem
  415.  
  416. Parameters
  417. item : ConfirmItem
  418. Current denied confirm item
  419.  
  420. Example
  421.  
  422. item:On('deny', function(item)
  423. print('You have denied the confirm item :D')
  424. end)
  425. ConfirmItem#event:enter
  426. Type: event
  427.  
  428. Event will be triggered when item becomes active/selected in NUI
  429.  
  430. Parameters
  431. item : Item
  432. Current active/selected item
  433.  
  434. Example
  435.  
  436. item:On('enter', function(item)
  437. print('You have entered this item :)')
  438. end)
  439. ConfirmItem#event:leave
  440. Type: event
  441.  
  442. Event will be triggered when item becomes inactive/unselected in NUI
  443.  
  444. Parameters
  445. item : Item
  446. Current inactive/unselected item
  447.  
  448. Example
  449.  
  450. item:On('leave', function(item)
  451. print('You have unselected this item :(')
  452. end)
  453. ConfirmItem#event:update
  454. Type: event
  455.  
  456. Event will be triggered when item's value changed
  457.  
  458. Parameters
  459. item : Item
  460. Current updated item
  461.  
  462. key : string
  463. Current updated key
  464.  
  465. value : any
  466. Current updated value
  467.  
  468. oldValue : any
  469. Previous value
  470.  
  471. Example
  472.  
  473. item:On('update', function(item, key, value, oldValue)
  474. print('You have updated this item :)')
  475. end)
  476. Item:class global
  477. Item for MenuV
  478.  
  479. Item#GetParentMenu(item)⇒Menu
  480. Type: function
  481.  
  482. Returns the Menu where item is added to (Parent Menu)
  483.  
  484. Parameters
  485. item : Item
  486. Item to get parent menu from
  487.  
  488. Returns: Menu — Parent's menu
  489.  
  490. Item#GetValue(item)⇒any|nil
  491. Type: function
  492.  
  493. Get current item's value with some validation, see Item.Value
  494.  
  495. Parameters
  496. item : Item
  497. Item to get value from
  498.  
  499. Returns: any|nil — Return current valid value or nil
  500.  
  501. Item#On(item, event, func)⇒void
  502. Type: function
  503.  
  504. Register a function as on event trigger
  505.  
  506. Parameters
  507. item : Item
  508. Item to register function for
  509.  
  510. event : string
  511. Name of on event to trigger
  512.  
  513. func : function
  514. Function to trigger
  515.  
  516. Item.Description:string static
  517. Value: ''
  518.  
  519. Type: string
  520.  
  521. Description of menu item
  522.  
  523. Item.Disabled:boolean static
  524. Value: ''
  525.  
  526. Type: boolean
  527.  
  528. Disabled state of menu item
  529.  
  530. Item.Icon:string static
  531. Value: 'none'
  532.  
  533. Type: string
  534.  
  535. Icon of menu item
  536.  
  537. Item.Label:string static
  538. Value: ''
  539.  
  540. Type: string
  541.  
  542. Label of menu item
  543.  
  544. Item.SaveOnUpdate:boolean static
  545. Value: false
  546.  
  547. Type: boolean
  548.  
  549. When item value changed, force to save changes
  550.  
  551. Item.UUID:string static readonly
  552. Type: string
  553.  
  554. Universally Unique Identifier (UUID)
  555.  
  556. Item.Value:any static
  557. Value: ''
  558.  
  559. Type: any
  560.  
  561. Value of menu item
  562.  
  563. Item#event:enter
  564. Type: event
  565.  
  566. Event will be triggered when item becomes active/selected in NUI
  567.  
  568. Parameters
  569. item : Item
  570. Current active/selected item
  571.  
  572. Example
  573.  
  574. item:On('enter', function(item)
  575. print('You have entered this item :)')
  576. end)
  577. Item#event:leave
  578. Type: event
  579.  
  580. Event will be triggered when item becomes inactive/unselected in NUI
  581.  
  582. Parameters
  583. item : Item
  584. Current inactive/unselected item
  585.  
  586. Example
  587.  
  588. item:On('leave', function(item)
  589. print('You have unselected this item :(')
  590. end)
  591. Item#event:update
  592. Type: event
  593.  
  594. Event will be triggered when item's value changed
  595.  
  596. Parameters
  597. item : Item
  598. Current updated item
  599.  
  600. key : string
  601. Current updated key
  602.  
  603. value : any
  604. Current updated value
  605.  
  606. oldValue : any
  607. Previous value
  608.  
  609. Example
  610.  
  611. item:On('update', function(item, key, value, oldValue)
  612. print('You have updated this item :)')
  613. end)
  614. Menu:class global
  615. Menu for MenuV
  616.  
  617. Menu#AddButton(menu, options={})⇒ButtonItem
  618. Type: function
  619.  
  620. This function will add a button item to Menu
  621.  
  622. Parameters
  623. menu : Menu
  624. Menu to add button for
  625.  
  626. options : table{}
  627. Button information
  628.  
  629. options.icon : string''
  630. Emoji as item prefex, see emojipedia.org
  631.  
  632. options.label : string''
  633. Label on button
  634.  
  635. options.description : string''
  636. Button description when this button is active
  637.  
  638. options.value : any|Menunil
  639. Button menu value, when value is a Menu, MenuV will open that Menu on button select
  640.  
  641. options.disabled : booleanfalse
  642. When this option is true, button isn't selectable anymore
  643.  
  644. Returns: ButtonItem — New button item
  645.  
  646. Example #1
  647.  
  648. local menu = MenuV:CreateMenu('MenuV', 'Welcome to MenuV', 'topleft', 255, 0, 0, 'size-125', 'example', 'menuv', 'example_namespace', 'native')
  649. local button = menu:AddButton({ icon = '😃', label = 'Example Button', value = 10, description = 'Example button' })
  650. Example #2
  651.  
  652. local menu = MenuV:CreateMenu('MenuV', 'Welcome to MenuV', 'topleft', 255, 0, 0, 'size-125', 'example', 'menuv', 'example_namespace', 'native')
  653. local menu2 = menu:InheritMenu({title = 'MenuV 2.0', subtitle = 'Inherit menu of `menu`', theme = 'default' })
  654. local button = menu:AddButton({ icon = '😃', label = 'Open Menu2', value = menu2, description = 'Open menu 2.0' })
  655. Menu#AddCheckbox(menu, options={})⇒CheckboxItem
  656. Type: function
  657.  
  658. This function will add a checkbox item to Menu
  659.  
  660. Parameters
  661. menu : Menu
  662. Menu to add checkbox item for
  663.  
  664. options : table{}
  665. Checkbox information
  666.  
  667. options.icon : string''
  668. Emoji as item prefex, see emojipedia.org
  669.  
  670. options.label : string''
  671. Label on checkbox
  672.  
  673. options.description : string''
  674. Checkbox description when this checkbox item is active
  675.  
  676. options.value : booleanfalse
  677. Checkbox item value
  678.  
  679. options.disabled : booleanfalse
  680. When this option is true, checkbox isn't selectable anymore
  681.  
  682. Returns: CheckboxItem — New checkbox item
  683.  
  684. Example
  685.  
  686. local menu = MenuV:CreateMenu('MenuV', 'Welcome to MenuV', 'topleft', 255, 0, 0, 'size-125', 'example', 'menuv', 'example_namespace', 'native')
  687. local checkbox = menu:AddCheckbox({ icon = '💡', label = 'Checkbox Example', value = false })
  688. Menu#AddConfirm(menu, options={})⇒ConfirmItem
  689. Type: function
  690.  
  691. This function will add a confirm item to Menu
  692.  
  693. Parameters
  694. menu : Menu
  695. Menu to add confirm item for
  696.  
  697. options : table{}
  698. Confirm information
  699.  
  700. options.icon : string''
  701. Emoji as item prefex, see emojipedia.org
  702.  
  703. options.label : string''
  704. Label on confirm item
  705.  
  706. options.description : string''
  707. Confirm description when this confirm item is active
  708.  
  709. options.value : booleanfalse
  710. Confirm menu value
  711.  
  712. options.disabled : booleanfalse
  713. When this option is true, confirm item isn't selectable anymore
  714.  
  715. Returns: ConfirmItem — New confirm item
  716.  
  717. Example
  718.  
  719. local menu = MenuV:CreateMenu('MenuV', 'Welcome to MenuV', 'topleft', 255, 0, 0, 'size-125', 'example', 'menuv', 'example_namespace', 'native')
  720. local confirm = menu:AddConfirm({ icon = '🔥', label = 'Example Confirm', value = false })
  721. Menu#AddRange(menu, options={})⇒RangeItem
  722. Type: function
  723.  
  724. This function will add a range item to Menu
  725.  
  726. Parameters
  727. menu : Menu
  728. Menu to add range item for
  729.  
  730. options : table{}
  731. Range information
  732.  
  733. options.icon : string''
  734. Emoji as item prefex, see emojipedia.org
  735.  
  736. options.label : string''
  737. Label on range item
  738.  
  739. options.description : string''
  740. Range item description when this range item is active
  741.  
  742. options.value : number0
  743. Range item value
  744.  
  745. options.min : number0
  746. Minimal range value
  747.  
  748. options.max : number0
  749. Maximal range value
  750.  
  751. options.disabled : booleanfalse
  752. When this option is true, range item isn't selectable anymore
  753.  
  754. Returns: RangeItem — New range item
  755.  
  756. Example
  757.  
  758. local menu = MenuV:CreateMenu('MenuV', 'Welcome to MenuV', 'topleft', 255, 0, 0, 'size-125', 'example', 'menuv', 'example_namespace', 'native')
  759. local range = menu:AddRange({ icon = '⚽', label = 'Example Range Item', min = 0, max = 10, value = 0, saveOnUpdate = true })
  760. Menu#AddSlider(menu, options={})⇒SliderItem
  761. Type: function
  762.  
  763. This function will add a slider item to Menu
  764.  
  765. Parameters
  766. menu : Menu
  767. Menu to add slider for
  768.  
  769. options : table{}
  770. Slider information
  771.  
  772. options.icon : string''
  773. Emoji as item prefex, see emojipedia.org
  774.  
  775. options.label : string''
  776. Label on slider
  777.  
  778. options.description : string''
  779. Slider description when this slider is active
  780.  
  781. options.value : number1
  782. Slider menu value, must be a valid index of SliderItem.Values
  783.  
  784. options.values : table[]
  785. List of values
  786.  
  787. value.label : string'Value'
  788. Label of value item
  789.  
  790. value.description : string''
  791. Description of value item
  792.  
  793. value.value : anynull
  794. Value of value item
  795.  
  796. options.disabled : booleanfalse
  797. When this option is true, slider isn't selectable anymore
  798.  
  799. Returns: SliderItem — New slider item
  800.  
  801. Example
  802.  
  803. local menu = MenuV:CreateMenu('MenuV', 'Welcome to MenuV', 'topleft', 255, 0, 0, 'size-125', 'example', 'menuv', 'example_namespace', 'native')
  804. local slider = menu:AddSlider({ icon = '❤️', label = 'Example Slider', value = 'demo', values = {
  805. { label = 'Demo Item', value = 'demo', description = 'Demo Item 1' },
  806. { label = 'Demo Item 2', value = 'demo2', description = 'Demo Item 2' },
  807. { label = 'Demo Item 3', value = 'demo3', description = 'Demo Item 3' },
  808. { label = 'Demo Item 4', value = 'demo4', description = 'Demo Item 4' }
  809. }})
  810. Menu#ClearItems(menu, update=true)⇒void
  811. Type: function
  812.  
  813. Clear all items in menu
  814.  
  815. Parameters
  816. menu : Menu
  817. Menu
  818.  
  819. update : booleantrue
  820. Force NUI update
  821.  
  822. Example #1
  823.  
  824. local menu = MenuV:CreateMenu('MenuV', 'Welcome to MenuV', 'topleft', 255, 0, 0, 'size-125', 'example', 'menuv', 'example_namespace', 'native')
  825. menu:ClearItems()
  826. Example #2
  827.  
  828. local menu = MenuV:CreateMenu('MenuV', 'Welcome to MenuV', 'topleft', 255, 0, 0, 'size-125', 'example', 'menuv', 'example_namespace', 'native')
  829. menu:ClearItems(false)
  830. Menu#Close(menu)⇒void
  831. Type: function
  832.  
  833. Close this menu
  834.  
  835. Parameters
  836. menu : Menu
  837. Menu
  838.  
  839. Example
  840.  
  841. local menu = MenuV:CreateMenu('MenuV', 'Welcome to MenuV', 'topleft', 255, 0, 0, 'size-125', 'example', 'menuv', 'example_namespace', 'native')
  842. menu:Close()
  843. Menu#InheritMenu(menu, overrides, namespace)⇒Menu
  844. Create a new menu from properties of this one (without items and events)
  845.  
  846. Parameters
  847. menu : Menu
  848. Menu
  849.  
  850. overrides : table
  851. A table with key values to override, see Menu options
  852.  
  853. namespace : string
  854. Unique namespace, see Menu.Namespace
  855.  
  856. Returns: Menu — New menu with properties of this one
  857.  
  858. Example
  859.  
  860. local menu = MenuV:CreateMenu('MenuV', 'Welcome to MenuV', 'topleft', 255, 0, 0, 'size-125', 'example', 'menuv', 'example_namespace', 'native')
  861. local menu2 = menu:InheritMenu({title = 'MenuV 2.0', subtitle = 'Inherit menu of `menu`', theme = 'default' })
  862. Menu#On(menu, event, func)⇒string
  863. Type: function
  864.  
  865. Register a function as on event trigger
  866.  
  867. Parameters
  868. menu : Menu
  869. Menu to register function for
  870.  
  871. event : string
  872. Name of on event to trigger
  873.  
  874. func : function
  875. Function to trigger
  876.  
  877. Returns: string — Universally Unique Identifier (UUID)
  878.  
  879. Example
  880.  
  881. local menu = MenuV:CreateMenu('MenuV', 'Welcome to MenuV', 'topleft', 255, 0, 0, 'size-125', 'example', 'menuv', 'example_namespace', 'native')
  882. menu:On('open', function(m)
  883. print('Menu is now open :D')
  884. end)
  885. Menu#Open(menu)⇒void
  886. Type: function
  887.  
  888. Open this menu
  889.  
  890. Parameters
  891. menu : Menu
  892. Menu
  893.  
  894. Example
  895.  
  896. local menu = MenuV:CreateMenu('MenuV', 'Welcome to MenuV', 'topleft', 255, 0, 0, 'size-125', 'example', 'menuv', 'example_namespace', 'native')
  897. menu:Open()
  898. Menu#OpenWith(menu, defaultType, defaultKey)⇒void
  899. Type: function
  900.  
  901. Register keybind for opening this menu, a unqiue Menu.Namespace is required
  902.  
  903. Parameters
  904. menu : Menu
  905. Menu
  906.  
  907. defaultType : string
  908. Default input type, like: KEYBOARD, MOUSE_BUTTON etc.
  909.  
  910. defaultKey : string
  911. Default input button, like: E, F12, LEFT_BUTTON etc.
  912.  
  913. Example
  914.  
  915. local menu = MenuV:CreateMenu('MenuV', 'Welcome to MenuV', 'topleft', 255, 0, 0, 'size-125', 'example', 'menuv', 'example_namespace', 'native')
  916. menu:OpenWith('keyboard', 'F1')
  917. Menu#RemoveOnEvent(menu, event, uuid)⇒void
  918. Type: function
  919.  
  920. Remove a registered on event
  921.  
  922. Parameters
  923. menu : Menu
  924. Menu to remove event for
  925.  
  926. event : string
  927. Name of on event to remove
  928.  
  929. uuid : string
  930. Universally Unique Identifier (UUID) of registered on event
  931.  
  932. Example
  933.  
  934. local menu = MenuV:CreateMenu('MenuV', 'Welcome to MenuV', 'topleft', 255, 0, 0, 'size-125', 'example', 'menuv', 'example_namespace', 'native')
  935. local event_uuid = menu:On('open', function(m)
  936. print('Menu is now open :D')
  937. end)
  938. menu:RemoveOnEvent('open', event_uuid)
  939. Menu#SetPosition(menu, position)⇒void
  940. Type: function
  941.  
  942. Change menu's position
  943.  
  944. Parameters
  945. menu : Menu
  946. Menu
  947.  
  948. position : string
  949. Menu position on screen
  950.  
  951. options:
  952.  
  953. topleft | topcenter | topright | centerleft | center | centerright | bottomleft | bottomcenter | bottomright
  954.  
  955. Example
  956.  
  957. local menu = MenuV:CreateMenu('MenuV', 'Welcome to MenuV', 'topleft', 255, 0, 0, 'size-125', 'example', 'menuv', 'example_namespace', 'native')
  958. menu:SetPosition('bottomright')
  959. Menu#SetSubtitle(menu, subtitle)⇒void
  960. Change menu's subtitle
  961.  
  962. Parameters
  963. menu : Menu
  964. Menu
  965.  
  966. subtitle : string
  967. Subtitle of menu
  968.  
  969. Example
  970.  
  971. local menu = MenuV:CreateMenu('MenuV', 'Welcome to MenuV', 'topleft', 255, 0, 0, 'size-125', 'example', 'menuv', 'example_namespace', 'native')
  972. menu:SetSubtitle('Example Subtitle')
  973. Menu#SetTitle(menu, title)⇒void
  974. Type: function
  975.  
  976. Change menu's title
  977.  
  978. Parameters
  979. menu : Menu
  980. Menu
  981.  
  982. title : string
  983. Title of menu
  984.  
  985. Example
  986.  
  987. local menu = MenuV:CreateMenu('MenuV', 'Welcome to MenuV', 'topleft', 255, 0, 0, 'size-125', 'example', 'menuv', 'example_namespace', 'native')
  988. menu:SetTitle('Example Title')
  989. Menu#ToTable(menu)⇒void
  990. Type: function
  991.  
  992. Transform Menu to table
  993.  
  994. Parameters
  995. menu : Menu
  996. Menu
  997.  
  998. Example
  999.  
  1000. local menu = MenuV:CreateMenu('MenuV', 'Welcome to MenuV', 'topleft', 255, 0, 0, 'size-125', 'example', 'menuv', 'example_namespace', 'native')
  1001. local menuData = menu:ToTable()
  1002. Menu.Color:table static
  1003. Value: { R=0, G=0, B=255 }
  1004.  
  1005. Type: table
  1006.  
  1007. Menu primary color as RGB
  1008.  
  1009. Menu.Color.B:number static
  1010. Value: 255
  1011.  
  1012. Type: number
  1013.  
  1014. Primary color RGB blue channel [0-255]
  1015.  
  1016. Menu.Color.G:number static
  1017. Value: 0
  1018.  
  1019. Type: number
  1020.  
  1021. Primary color RGB green channel [0-255]
  1022.  
  1023. Menu.Color.R:number static
  1024. Value: 0
  1025.  
  1026. Type: number
  1027.  
  1028. Primary color RGB red channel [0-255]
  1029.  
  1030. Menu.Dictionary:string static
  1031. Value: 'menuv'
  1032.  
  1033. Type: string
  1034.  
  1035. Texture dictionary name for the banner image
  1036.  
  1037. Menu.IsOpen:boolean static readonly
  1038. Value: false
  1039.  
  1040. Type: string
  1041.  
  1042. Menu "open" state
  1043.  
  1044. Menu.Namespace:string static readonly
  1045. Value: 'unknown'
  1046.  
  1047. Type: string
  1048.  
  1049. Namespace is required to set keybinds, make sure given namespace is unique for every menu.
  1050.  
  1051. Menu.Position:string static
  1052. Value: 'topleft'
  1053.  
  1054. Type: string
  1055.  
  1056. Menu position on screen
  1057.  
  1058. options:
  1059.  
  1060. topleft | topcenter | topright | centerleft | center | centerright | bottomleft | bottomcenter | bottomright
  1061.  
  1062. Menu.Size:string static
  1063. Value: 'size-110'
  1064.  
  1065. Type: string
  1066.  
  1067. Menu size in %
  1068.  
  1069. options:
  1070.  
  1071. size-100 | size-110 | size-125 | size-150 | size-175 | size-200
  1072.  
  1073. Menu.Subtitle:string static
  1074. Value: ''
  1075.  
  1076. Type: string
  1077.  
  1078. Subtitle that appears in capital letters in a small black bar.
  1079.  
  1080. Menu.Texture:string static
  1081. Value: 'default'
  1082.  
  1083. Type: string
  1084.  
  1085. Texture name for the banner image
  1086.  
  1087. Menu.Theme:string static readonly
  1088. Value: 'default'
  1089.  
  1090. Type: string
  1091.  
  1092. Change the look of MenuV by changing the theme
  1093.  
  1094. Default: https://i.imgur.com/xGagIBm.png
  1095.  
  1096. Native: https://i.imgur.com/KSkeiQm.png
  1097.  
  1098. Menu.Title:string static
  1099. Value: 'MenuV'
  1100.  
  1101. Type: string
  1102.  
  1103. Title that appears on the big banner.
  1104.  
  1105. Menu.UUID:string static readonly
  1106. Type: string
  1107.  
  1108. Universally Unique Identifier (UUID)
  1109.  
  1110. Menu~options:object inner
  1111. CreateMenu options
  1112.  
  1113. Parameters
  1114. options.namespace : stringunknown
  1115. Namespace is required to set keybinds, make sure given namespace is unique for every menu.
  1116.  
  1117. options.title : boolean|stringMenuV
  1118. Title that appears on the big banner.
  1119.  
  1120. options.subtitle : string""
  1121. Subtitle that appears in capital letters in a small black bar.
  1122.  
  1123. options.position : string"topleft"
  1124. Menu position on screen options:
  1125.  
  1126. topleft | topcenter | topright | centerleft | center | centerright | bottomleft | bottomcenter | bottomright
  1127.  
  1128. options.r : number0
  1129. Primary color RGB red channel [0-255]
  1130.  
  1131. options.g : number0
  1132. Primary color RGB green channel [0-255]
  1133.  
  1134. options.b : number255
  1135. Primary color RGB blue channel [0-255]
  1136.  
  1137. options.size : stringsize-110
  1138. Menu size in %
  1139.  
  1140. options:
  1141.  
  1142. size-100 | size-110 | size-125 | size-150 | size-175 | size-200
  1143.  
  1144. options.dictionary : stringmenuv
  1145. Texture dictionary name for the banner image
  1146.  
  1147. options.texture : stringdefault
  1148. Texture name for the banner image
  1149.  
  1150. options.events : table{}
  1151. Custom events to add
  1152.  
  1153. options.validate : functionnil
  1154. Custom Menu.Validate function
  1155.  
  1156. options.newIndex : functionnil
  1157. Custom Menu.NewIndex function
  1158.  
  1159. Menu#event:close
  1160. Type: event
  1161.  
  1162. Event will be triggered when menu is closed
  1163.  
  1164. Parameters
  1165. menu : Menu
  1166. Current closed menu
  1167.  
  1168. Example
  1169.  
  1170. menu:On('close', function(menu)
  1171. print('You have now closed the menu :)')
  1172. end)
  1173. Menu#event:open
  1174. Type: event
  1175.  
  1176. Event will be triggered when menu is opened
  1177.  
  1178. Parameters
  1179. menu : Menu
  1180. Current opened menu
  1181.  
  1182. Example
  1183.  
  1184. menu:On('open', function(menu)
  1185. print('You have now opened the menu :)')
  1186. end)
  1187. RangeItem:class global
  1188. Extends: Item
  1189.  
  1190. Range item for MenuV
  1191.  
  1192. RangeItem#SetMaxValue(input)⇒void
  1193. Type: function
  1194.  
  1195. Change RangeItem.Max
  1196.  
  1197. Parameters
  1198. input : number
  1199. New maximal value
  1200.  
  1201. RangeItem#SetMinValue(input)⇒void
  1202. Type: function
  1203.  
  1204. Change RangeItem.Min
  1205.  
  1206. Parameters
  1207. input : number
  1208. New minimal value
  1209.  
  1210. RangeItem.Max:number static
  1211. Value: 0
  1212.  
  1213. Type: number
  1214.  
  1215. Maximal possible value
  1216.  
  1217. RangeItem.Min:number static
  1218. Value: 0
  1219.  
  1220. Type: number
  1221.  
  1222. Minimal possible value
  1223.  
  1224. RangeItem.Value:number static
  1225. Value: 0
  1226.  
  1227. Type: number
  1228.  
  1229. Value of range item (default lowest possible value)
  1230.  
  1231. RangeItem#event:change
  1232. Type: event
  1233.  
  1234. Event will be triggered when user changed range state
  1235.  
  1236. Parameters
  1237. item : RangeItem
  1238. Current changed range item
  1239.  
  1240. newValue : number
  1241. New value of range item
  1242.  
  1243. oldValue : number
  1244. Previous value of range item
  1245.  
  1246. Example
  1247.  
  1248. item:On('change', function(item, newValue, oldValue)
  1249. print('You have changed them range :)')
  1250. end)
  1251. RangeItem#event:enter
  1252. Type: event
  1253.  
  1254. Event will be triggered when item becomes active/selected in NUI
  1255.  
  1256. Parameters
  1257. item : Item
  1258. Current active/selected item
  1259.  
  1260. Example
  1261.  
  1262. item:On('enter', function(item)
  1263. print('You have entered this item :)')
  1264. end)
  1265. RangeItem#event:leave
  1266. Type: event
  1267.  
  1268. Event will be triggered when item becomes inactive/unselected in NUI
  1269.  
  1270. Parameters
  1271. item : Item
  1272. Current inactive/unselected item
  1273.  
  1274. Example
  1275.  
  1276. item:On('leave', function(item)
  1277. print('You have unselected this item :(')
  1278. end)
  1279. RangeItem#event:select
  1280. Type: event
  1281.  
  1282. Event will be triggered when user pressed 'ENTER' in range item
  1283.  
  1284. Parameters
  1285. item : RangeItem
  1286. Current selected range item
  1287.  
  1288. value : number
  1289. Value of range item
  1290.  
  1291. Example
  1292.  
  1293. item:On('select', function(item, value)
  1294. print('You have select a range option :)')
  1295. end)
  1296. RangeItem#event:update
  1297. Type: event
  1298.  
  1299. Event will be triggered when item's value changed
  1300.  
  1301. Parameters
  1302. item : Item
  1303. Current updated item
  1304.  
  1305. key : string
  1306. Current updated key
  1307.  
  1308. value : any
  1309. Current updated value
  1310.  
  1311. oldValue : any
  1312. Previous value
  1313.  
  1314. Example
  1315.  
  1316. item:On('update', function(item, key, value, oldValue)
  1317. print('You have updated this item :)')
  1318. end)
  1319. SliderItem:class global
  1320. Extends: Item
  1321.  
  1322. Slider item for MenuV
  1323.  
  1324. SliderItem#AddValue(item, value)⇒void
  1325. Type: function
  1326.  
  1327. Add a value to slider
  1328.  
  1329. Parameters
  1330. item : SliderItem
  1331. SliderItem to add a value for
  1332.  
  1333. value : table
  1334. Value information
  1335.  
  1336. value.label : string'Value'
  1337. Label of value item
  1338.  
  1339. value.description : string''
  1340. Description of value item
  1341.  
  1342. value.value : anynull
  1343. Value of value item
  1344.  
  1345. SliderItem#AddValues(item, ...values)⇒void
  1346. Type: function
  1347.  
  1348. Add a list of values to slider
  1349.  
  1350. Parameters
  1351. item : SliderItem
  1352. SliderItem to add values for
  1353.  
  1354. ...values : ...table
  1355. Value information
  1356.  
  1357. value.label : string'Value'
  1358. Label of value item
  1359.  
  1360. value.description : string''
  1361. Description of value item
  1362.  
  1363. value.value : anynull
  1364. Value of value item
  1365.  
  1366. SliderItem.Value:number static
  1367. Value: 1
  1368.  
  1369. Type: number
  1370.  
  1371. Value of slider item (current selected index)
  1372.  
  1373. SliderItem#event:change
  1374. Type: event
  1375.  
  1376. Event will be triggered when user changed slider state
  1377.  
  1378. Parameters
  1379. item : SliderItem
  1380. Current changed slider item
  1381.  
  1382. newValue : number
  1383. New index of slider item
  1384.  
  1385. oldValue : number
  1386. Previous index of slider item
  1387.  
  1388. Example
  1389.  
  1390. item:On('change', function(item, newValue, oldValue)
  1391. print('You have changed them slider :)')
  1392. end)
  1393. SliderItem#event:enter
  1394. Type: event
  1395.  
  1396. Event will be triggered when item becomes active/selected in NUI
  1397.  
  1398. Parameters
  1399. item : Item
  1400. Current active/selected item
  1401.  
  1402. Example
  1403.  
  1404. item:On('enter', function(item)
  1405. print('You have entered this item :)')
  1406. end)
  1407. SliderItem#event:leave
  1408. Type: event
  1409.  
  1410. Event will be triggered when item becomes inactive/unselected in NUI
  1411.  
  1412. Parameters
  1413. item : Item
  1414. Current inactive/unselected item
  1415.  
  1416. Example
  1417.  
  1418. item:On('leave', function(item)
  1419. print('You have unselected this item :(')
  1420. end)
  1421. SliderItem#event:select
  1422. Type: event
  1423.  
  1424. Event will be triggered when user pressed 'ENTER' in slider item
  1425.  
  1426. Parameters
  1427. item : SliderItem
  1428. Current selected slider item
  1429.  
  1430. value : any
  1431. Value from selected option
  1432.  
  1433. Example
  1434.  
  1435. item:On('select', function(item, value)
  1436. print('You have select a slider option :)')
  1437. end)
  1438. SliderItem#event:update
  1439. Type: event
  1440.  
  1441. Event will be triggered when item's value changed
  1442.  
  1443. Parameters
  1444. item : Item
  1445. Current updated item
  1446.  
  1447. key : string
  1448. Current updated key
  1449.  
  1450. value : any
  1451. Current updated value
  1452.  
  1453. oldValue : any
  1454. Previous value
  1455.  
  1456. Example
  1457.  
  1458. item:On('update', function(item, key, value, oldValue)
  1459. print('You have updated this item :)')
  1460. end)
  1461. table:object global
  1462. Object
  1463.  
  1464. threads:Array<number> global
  1465. List of threads
  1466.  
  1467.  
  1468. Documentation built with Docma.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement