Math & Utility
Mathematical functions and utility operations.
Functions
split()
split(str:string, regex:string) -> string[]
- Description: Split string by regex
- Parameters:
str:string- String to splitregex:string- Regex to split by
- Returns:
string[]- Array of strings
- Example:lua
str = "a,b,c" for _, letter in pairs(str:split(",")) do log(letter) end
ImVec2()
ImVec2(x:number, y:number) -> Vec2
- Description: Sets width and height or value
- Parameters:
x(number) - X coordinatey(number) - Y coordinate
- Returns:
Vec2- 2D vector
- Example:lua
ImVec2(1,0.3)
ImVec4()
ImVec4(x:number, y:number, z:number, w:number) -> Vec4
- Description: Sets color value
- Parameters:
x(number) - Red valuey(number) - Green valuez(number) - Blue valuew(number) - Alpha value
- Returns:
Vec4- 4D vector
- Example:lua
ImVec4(0,0.55,0.56,1)
getTime()
getTime() -> number
- Description: Current time in ms
- Returns:
number- Current time in milliseconds
- Note:
- The native code reads the microsecond based
system_clockvalue and divides it by 1000, so the result is milliseconds.
- The native code reads the microsecond based
- Example:lua
log(getTime())
string:split()
string:split(sep:string) -> string[]
- Description: Split string by sep
- Parameters:
sep:string- Separator
- Returns:
string[]- Array of strings
- Example:lua
str = "1,2" for _, part in pairs(str:split(",")) do log(part) end
writeToLocal()
writeToLocal(name:string, s:string)
- Description: Write local file/data
- Parameters:
name:string- File names:string- Content to write
- Returns:
- None
- Example:lua
writeToLocal("save.txt","ok")
getAppLibrary()
getAppLibrary() -> string
- Description: Get app library path
- Returns:
string- Library path
- Example:lua
log(getAppLibrary())
executeFromAssets()
executeFromAssets(path:string, name:string)
- Description: Deprecated execute asset
- Parameters:
path:string- Asset pathname:string- Asset name
- Returns:
- None
- Note:
- Still implemented in Growlauncher 7.0.38 even though it is marked deprecated. It loads the asset script and shows a deprecation notice that can be suppressed with the
dont_show_setting. An empty path raises a Lua error (Execute failed).
- Still implemented in Growlauncher 7.0.38 even though it is marked deprecated. It loads the asset script and shows a deprecation notice that can be suppressed with the
error()
error(text:string)
- Description: Shows an error warning
- Parameters:
text:string- Error text
- Returns:
- None
- Example:lua
error("error text")
fetch()
fetch(url:string) -> response, error
- Description: Get text data from url
- Parameters:
url:string- URL to fetch
- Returns:
response- Response data,error- Error message
- Example:lua
fetch("https://raw.githubusercontent.com/PowerKuy/Growlauncher-Documentation/refs/heads/main/sample-scripts/example-for-fetch.lua")
getDiscordID()
getDiscordID() -> string
- Description: Get user discord id
- Returns:
string- Discord ID as decimal text
- Example:lua
log(getDiscordID())