Yuari
Documentation

loadstring

Compiles a string with the Luau compatibility pass applied. Like Roblox, syntax errors yield a function that raises the error when called.

Syntax

loadstring(source: string, chunkName?: string) -> function

Parameters

ParameterTypeDescription
sourcestringLuau source code to compile or execute.
chunkName?stringThe chunk name value used by the call.

Returns

TypeDescription
functionFunction

Description

loadstring is part of the Scripts & decompiling library. Script helpers inspect scripts in the live DataModel and can read bytecode or decompile source.

Each call creates or returns a fresh object or value that you can store and pass to other functions.

Example

local fn = loadstring("print('hello from a string')")
fn()

Notes

  • Script bytecode and source are read from the live game.