LuaASM is a fork of TPScript, which is an experimental scripting language developed for Roblox (not made for production use, of course).
Our fork has more instructions than TPScript which can cause compatibility issues so please keep this in mind.
Instructions marked with a:
call (function) (arguments)
Calls a Lua / Luau function. ()
callif (function) (boolean variable) (arguments)
Calls a Lua / Luau function if the boolean variable is true. ()
callset (towrite) (function) (arguments)
Calls a Lua / Luau function, and sets (towrite)
to the return value. ()
safecall (function) (arguments)
Calls a Lua / Luau function, but wrapped in a pcall. ()
safecallset (towrite) (function) (arguments)
Calls a Lua / Luau function, and sets (towrite)
to the return value, but wrapped in a pcall. ()
setindex (object) (index) (value)
Sets an index of an object. ()
setfindex (object) (towrite) (index)
Sets a variable to an index of an object. ()
set (variable) (value)
Sets a variable with a value. ()
setstr (variable) (string)
Sets a variable with a string. ()
settbl (variable) (arguments)
Sets a variable with a table filled with arguments. ()
log (variable)
Logs a variable to the console. ()
logtxt (text)
Logs text to the console. ()
logtbl (table)
Logs the contents of a table to the console. ()
ls (string)
Loadstring a script. ()
rpt (boolean variable)
Starts a repeat loop, that will only loop if the boolean is true. ()
loop
Ends a loop if a rpt
has been instructed already. ()
cat (to write) (to concat)
Concats the argumented strings together and sets the variable. ()
opp (variable)
Sets a boolean variable to the opposite of itself. TPScript uses not
, so it's considered incompatible. ()
neg (variable)
Sets a number variable to the negative of itself. ()
len (towrite) (variable)
Gets the length of a table or string. ()
chk (towrite) (type) (variable_a) (variable_b)
Checks / compares two variables. ()
Valid types and what they do:
'$equ' => (variable_a == variable_b)
'$grt' => (variable_a > variable_b)
'$lss' => (variable_a < variable_b)
'$elss' => (variable_a >= variable_b)
'$egrt' => (variable_a <= variable_b)
cmt
Doesn't do anything, used for comments. ()
opr (variable) (type) (tooperate)
Operates on a variable. TPScript may support this eventually. ()
Valid types and what they do:
'$add' => (variable + tooperate)
'$sub' => (variable - tooperate)
'$mul' => (variable * tooperate)
'$div' => (variable / tooperate)
hook (tohook) (path) (allowinteruptions / boolean)
Hooks to an RBXScriptSignal to jump to a jmp
label. (May be broken right now) ()
ret (optional return values)
Ends a VF
with or without additional return values likely functions differently in TPScript ()
halt (number)
Waits for (number)
milliseconds. wait (number)
is the supplement for TPScript. ()
tick
Waits for the next Heartbeat. ()
jmp (label)
Jumps to the specified jmp
label.
jmpif (variable) (label)
Jumps to the specified jmp
label if (variable)
is true.
Replace with opr
:
add (variable) (number)
Adds (variable)
and (number)
together. Replaced by opr $add
.
sub (variable) (number)
Subtracts (variable)
and (number)
. Replaced by opr $sub
.
mul (variable) (number)
Multiplies (variable)
and (number)
together. Replaced by opr $mul
.
div (variable) (number)
Divides (variable)
and (number)
together. Replaced by opr $div
.
The above instructions only work if you enable the Full Compatibility plugin.
Please use VFs for new work. Jump Labels have been deprecated to allow for compilers to be sensibly completed.
Jump labels are used for jmp
and jmpif
.
They are defined by ::name
or @name
(exclusively for LuaASM), and allow you to move to different points in your script.
Virtual functions are essentially just the interpreter wrapped in a lua function. They support jump labels, arguments and return values.
They are defined by :-
(exclusively for LuaASM), and are only callable from call
, safecall
, callset
, and safecallset
.
Also, they will be ignored by the interpreter; meaning they can be placed just about anywhere without issues.
Calling a virtual function inside a virtual function seems to work fine. If there's any issues, please shoot me a dm (tag is in asm.lua
)
Example:
:-test a; cmt a is an argument;
log a;
ret a; cmt just returns the "a" argument because i'm lazy;
callset b test 10; cmt calls the test virtual function and sets the "b" variable to the return value;
log b;
TPScript will only run your script until it reaches the last instruction.
LuaASM doesn't stop, and instead just loops over a wait
(only if there's at least one hook active.)
15
This was designed for Luau. There isn't planned support for any other environments.
Use TPScript directly if you want support for regular Lua 5.1! :)
More examples are available under the examples/ directory.