Giter Site home page Giter Site logo

luaasm's Introduction

LuaASM

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.

${\textsf{\color{#af0a0a}This project is NOT maintained anymore. Some changes may be pushed out at random, but do not expect any scheduled updates.}}$

Documentation

Instructions marked with a:

  • green dot, are safe to use in tpscript & LuaASM ()
  • yellow dot, are only usable in LuaASM ()

Instructions List

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) ()


end Stops the script. ()


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. ()

Deprecated Instructions

jmp (label) Jumps to the specified jmp label.


jmpif (variable) (label) Jumps to the specified jmp label if (variable) is true.

Discontinued Instructions

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.

Jump Labels

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

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;

Additional Information (about LuaASM / TPScript)

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

Notes

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.

luaasm's People

Contributors

raymonable avatar headsmasher8557 avatar

Watchers

Yasin Mohammad avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.