Compiler library
Just like Powerlang, almostLua also has a unique compiler library which can be used to interact with compile-time services. For example, you may want to insert a RetroStudio block that doesn't exist in almostLua, or optimize a heavy equation.
The compiler library contains the following functions: InsertBlock
, InsertBlockAndFunction
, Equation
, Path
, credits
, version
and printexpbl
.
The InsertBlock
function inserts a specified RetroStudio block in such a way that it's not affected by previous blocks nor does it affect following blocks. InsertBlockAndFunction
serves the same purpose, however it also calls a specified function after the block, which is helpful for setting up events or triggers that may not exist in almostLua.
The syntax of InsertBlock
is as follows:
where BlockName is the name of the block you'd like to insert, and ... are the arguments you'd like to pass. For example, if you wanted to insert a Print block, you'd do
You can find block names and parameters in a module called ProgrammingBlocksData located in the root folder of almostLua source code. Note that when calling InsertBlock, the block name must be a string, not a variable or any other data type. This is because this operation is done at the compiler level, and the compiler does not know the values of variables.
The InsertBlockAndFunction
has similar functionality, except it tries to call a function you define with at most 5 outputs of the block created. The syntax is as follows:
Note that InsertBlockAndFunction does not return anything. Here's how you can redirect a Set Variable block to a function of your choosing:
The Equation and Path functions have similar syntax:
The credits
and version
methods return static strings located in the root of the almostLua source code:
Last updated