Engine
engine.load_string
Shared
Executes a buffer within the engine
Syntax
local result = engine.load_string(buffer, autoload = true)Parameters
| Type | Name | Description |
|---|---|---|
string | buffer | Buffer containing code to be loaded and executed |
bool | autoload | Determines execution behavior: • When true - the loaded function executes immediately• When false - returns a callable function for deferred execution |
Returns
| Type | Name | Description |
|---|---|---|
function / bool | result | • When autoload is false - returns the loaded function on success, or false on failure• When autoload is true - returns true on successful execution, or false on failure |
Examples
--Immediate execution with autoload enabled
local success = engine.load_string([[
engine.print("Immediate", "Execution")
]], true)--Deferred execution with autoload disabled
local exec = engine.load_string([[
engine.print("Delayed", "Execution")
]], false)
if exec then
exec() --Execute the loaded function manually
end