How To Use
Place the module in the same folder with the main script. This module can be called by using require function like this:
Code: Select all Reset
local funName = require('moduleName.plugin/module/moduleName.lua') -- funName can be replaced with another name you want to use. moduleName can be replaced only by the file name you download from this post.
Interactive Lua editor
Run
Output: Select all
...
Show
This function can be used for a text that longer than the parent GUI.
Download :
- running label.png (18.99 KiB) Viewed 7893 times
Code: Select all Reset
local runText = require('runText.plugin/module/runText.lua') -- runText(args) -- Parameters : -- args : (table) A table that contains the source, text, and optional values. -- Returns : -- (table) A table that contains the label. -- Usage : runText{ source = parent, -- Attaches the label to this object. The X, Y, Width, Height parameters will follow this object as parent. w = 128, -- Sets the width of the label. Default the width of the source. (optional) h = 26, -- Sets the height of the label. Default the height of the source. (optional) id = '$runningText', -- Id for the label. (optional) text = 'string' or function() return value end, -- A text to display. String is used for fixed values. Function is used for changeable values. color = {256,256,256}, -- (table) Sets the color of the text. Default {256,256,256} white. (optional) font = Font.DEFAULT, -- Sets the font of the text. Default Font.DEFAULT. (optional) speed = 0.5 -- Sets the speed of the text movements. Default 0.5. (optional) }
Interactive Lua editor
Run
Output: Select all
...
- runText.plugin
- (993 Bytes) Downloaded 159 times
Show
This function can be used for create a movable button.
Download :
- movable button.png (19.5 KiB) Viewed 7893 times
Code: Select all Reset
local moveButton = require('moveButton.plugin/module/moveButton.lua') -- moveButton(args) -- Parameters : -- args : (table) A table that contains the button. -- Returns : -- (table) A table that represents the button. -- Usage : moveButton{ x = 30, -- Sets the x. Default 30. (optional) y = 30, -- Sets the y. Default 30. (optional) w = 0, -- Sets the width. Default 0 or same as the height. (optional) h = 26, -- Sets the height. Default 26. (optional) index = 10, -- Sets the child index of the button. Useful if a button should in the background or foreground of another GUI. Default 10. (optional) icon = Icon.OK, -- Sets the icon of the button. frameDefault = NinePatch.BUTTON, -- Sets the default frame of the button. Default NinePatch.BUTTON. (optional) frameDown = NinePatch.BUTTON, -- Sets the pressed frame of the button. Default NinePatch.BUTTON_DOWN. (optional) saveValue = function(x,y) -- A function to save the new position of x and y coordinates into storage. local storage -- the storage variable storage.x = x storage.y = y end, onClick = function() -- Will be called when the button gets clicked Debug.toast('Hello World') end }
Interactive Lua editor
Run
Output: Select all
...
- moveButton.plugin
- (1.02 KiB) Downloaded 148 times
Show
This function can be used for a long text that can be placed in listbox or anythings.
Download :
- longtext.PNG (36.5 KiB) Viewed 7681 times
Code: Select all Reset
local splitLabel = require('splitLabel.plugin/module/splitLabel.lua') -- splitLabel(args) -- Parameter : -- args : (table) a table that contains source, text, padding, color, and font. -- Returns : -- (table) A table that contains the long text. -- Usage : splitLabel{ source = parent, -- Attaches the label to this object. The X, Y, Width, Height parameters will follow this object as parent. text = 'string', -- A text to display. the long text will be automatically split and the total row will be calculated depends on the parent width. color = {0,0,0}, -- (table) Sets the color of the text. Default {0,0,0} black. (optional) font = Font.DEFAULT, -- Sets the font of the text. Default Font.DEFAULT. (optional) padding = {2,0,5,0} -- (table) Sets the padding (left,top,right,bottom) of the label. Default {2,0,5,0}. (optional) }
Interactive Lua editor
Run
Output: Select all
...
- splitLabel.plugin
- (1019 Bytes) Downloaded 158 times
! | Message from: ian` |
Don't use Lua Wrapper when you using the require function, because it will occur an error. You can use this function when you are done with other stuff on your script. If you upload your plugin and it contains this module, please set the minimum version to at least 1949. |
Off Topic
This module is free to use. Give me a credit in your plugins is optional, but you can benefit from doing so.