Helium Luau API Documentation
This document provides a complete reference for all the custom Luau functions exposed by Helium's environment. The functions are organized by their specific utility categories.
Environment & General Utility
identifyexecutor
Returns the name of the current executor.
Returns: string - "Helium"
local executor = identifyexecutor()
print(executor) -- Output: Helium
getgenv
Returns the global environment table for the executor, allowing you to store variables globally across scripts.
Returns: table - The global environment table.
local env = getgenv()
env.MyGlobalVariable = "Hello World"
consoleprint
Outputs a string to the Helium console.
Parameters:
* str (string) - The message to log.
consoleprint("Debugging message!")
loadstring
Compiles a string of Luau code into a callable function.
Parameters:
* code (string) - The code to compile.
Returns: function or nil - The compiled function (or nothing if compilation fails).
local func = loadstring("print('Executing dynamic code!')")
func()
httpget
Performs a synchronous HTTP GET request and returns the response body as a string.
Parameters:
* url (string) - The URL to fetch.
Returns: string or nil - The HTTP response.
local response = httpget("https://raw.githubusercontent.com/user/repo/main/script.lua")
print(response)
Closures & Hooking
hookfunction
Hooks a target function by replacing its internal handler with your own hook function. It returns the original function so it can still be called.
Parameters:
* target (function) - The original function to hook.
* hook (function) - Your custom function that will replace the target.
Returns: function - The original unhooked function.
local old_print
old_print = hookfunction(print, function(...)
old_print("Hooked print:", ...)
end)
newcclosure
Wraps a regular Luau function into a C closure. This is useful for bypassing environment checks that look for C closures.
Parameters:
* func (function) - The Luau function to wrap.
Returns: function - The wrapped C closure.
local fn = newcclosure(function()
print("Running inside a C closure")
end)
iscclosure
Checks whether a given function is a C closure.
Parameters:
* func (function) - The function to check.
Returns: boolean - True if the function is a C closure, false otherwise.
local fn = newcclosure(function()
return true;
end)
print(iscclosure(fn)) -- true
print(iscclosure(print)) -- true
print(iscclosure(function(...) end)) -- false
Encoding
base64encode
Encodes a standard string into a Base64 string.
Parameters:
* str (string) - The string to encode.
Returns: string - The Base64 encoded string.
local b64 = base64encode("Hello World")
print(b64) -- Output: SGVsbG8gV29ybGQ=
base64decode
Decodes a Base64 string back into standard text.
Parameters:
* str (string) - The Base64 string to decode.
Returns: string - The decoded string.
local text = base64decode("SGVsbG8gV29ybGQ=")
print(text) -- Output: Hello World
Filesystem
!!! warning "Sandboxed Execution"
The filesystem functions operate exclusively within the executor's workspace/sandboxed folder.
C:\Users\USERNAME\AppData\Roaming\Helium\workspace
readfile
Reads the entire content of a file.
Parameters:
* filepath (string) - The name or path of the file.
Returns: string - The contents of the file.
local content = readfile("config.txt")
writefile
Writes content to a file, replacing the file if it already exists.
Parameters:
* filepath (string) - The name or path of the file.
* content (string) - The content to write.
writefile("config.txt", "Larp=true")
appendfile
Appends content to the end of an existing file.
Parameters:
* filepath (string) - The name or path of the file.
* content (string) - The content to append.
appendfile("log.txt", "\nError at line 45")
makefolder
Creates a new directory.
Parameters:
* foldername (string) - The name of the folder to create.
makefolder("Configs")
isfile
Checks whether a specific file exists.
Parameters:
* filepath (string) - The path to check.
Returns: boolean - True if the file exists.
if isfile("settings.json") then
print("Settings file found!")
end
isfolder
Checks whether a specific folder exists.
Parameters:
* foldername (string) - The path to check.
Returns: boolean - True if the folder exists.
if isfolder("Configs") then
print("Configs directory exists.")
end
delfile
Deletes a specific file.
Parameters:
* filepath (string) - The file to delete.
delfile("old_config.txt")
delfolder
Deletes a specific folder.
Parameters:
* foldername (string) - The folder to delete.
delfolder("Temp")
Script Caching
getscriptbytecode
Retrieves the compiled bytecode for a cached script by its name.
Parameters:
* script_name (string) - The name of the script.
Returns: string or nil - The raw bytecode string.
local bytecode = getscriptbytecode(game.ScriptService.ClientScript)
dumpscriptcache
Dumps the entire script cache into a table, mapping script names to their raw bytecode.
Returns: table - A dictionary where keys are script names and values are bytecode strings.
local cache = dumpscriptcache()
for name, bytecode in pairs(cache) do
print(name, "Size:", #bytecode)
end
Input Simulation
!!! note "Focus Required" Input simulation functions will only execute if the game window is currently focused.
keydown / keyup / keypress
Simulates keyboard inputs. keypress simulates a full down-and-up stroke.
Parameters:
* key (string) - The string representation of the key (e.g., "W", "Space", "Enter").
keydown("W")
task.wait(1)
keyup("W")
-- Or perform a quick tap:
keypress("Space")
mouse1down / mouse1up / mouse1click
Simulates left mouse button events.
mouse1down()
task.wait(0.1)
mouse1up()
-- Or perform a quick click:
mouse1click()
mouse2down / mouse2up / mouse2click
Simulates right mouse button events.
mouse2down()
task.wait(0.1)
mouse2up()
-- Or perform a quick click:
mouse2click()
mousemove
Moves the mouse cursor by a relative offset from its current position.
Parameters:
* x (number) - Relative X offset.
* y (number) - Relative Y offset.
mousemove(100, 0) -- Moves mouse 100 pixels to the right
mousemoveabs
Moves the mouse cursor to an absolute screen coordinate.
Parameters:
* x (number) - Absolute X coordinate.
* y (number) - Absolute Y coordinate.
mousemoveabs(960, 540) -- Moves mouse to the center of a 1080p screen