MicroTerminal is a simple library that allows for the creation of functional GUI-less plugins in Roblox. To start, simply install the library, create a plugin and write the following code.
local MicroTerminal = require(path.to.MicroTerminal)
function command(runContext: MicroTerminal.RunContext)
print("Running command")
end
MicroTerminal.RegisterCommandToRobloxOutput("example", command)
If you then type --example
(two dashes followed by a command prefix is the start of all commands in MicroTerminal) in the Command Bar, it will print Running command
in the output. How neat is that?
MicroTerminal exposes many methods to parse commands. Take for example the command example --mode=17 ;Players;Player1.Character;Humanoid
. To handle this, the function should use the RunContext object.
The “
;Players;Player1.Character;Humanoid
” is an instance path, a way of representing Instances using a string. It resembles file paths in many computers but with;
replacing/
. In this case, it points to Player1’s Humanoid.
function command(runContext: MicroTerminal.RunContext)
-- It is casted into a number automatically!
local mode: number = runContext:ContainsFlags(1, "--mode={number}")
-- The second parameter is used because the first one is just the command prefix
local parent: Instance? = runContext:Param(2, "instance")
print("Using mode " .. mode .. " in Instance " .. parent.Name)
end
When typed into the Command Bar, the command would look like this.
Yes, I know the double dash used to start the command is weird here. It’s just so errors aren’t thrown when this is put into the command bar. A workaround I used was to have a
!
at the start of every command prefix.
Documentation
Documentation is currently being worked on and is not complete. For now, refer to docs.md
that serves as temporary documentation. For a more practical example, read examples/imp.server.luau
which implements a toolbox and catalog asset importing plugin using MicroTerminal. You can also install it here.