Powerlang Docs
  • Welcome!
  • Beginner's Guide
    • Syntax
    • Directives
    • Environment
    • Special types
    • Functions
    • Tables
    • Loops
    • Conditions
    • Events
    • Libraries
    • Comments and Flags
  • Creating a Game
    • Project Introduction: Potato Rush
    • Creating the main game loop
    • Creating potatoes
    • Keeping track of score
  • Libraries
    • Special Types
      • BrickColor
      • CFrame
      • Color3
      • Instance
      • NumberRange
      • UDim2
      • Vector2
      • Vector3
    • Services
      • DataStore
      • Debris
      • Mouse
      • Pathfinding
      • PhysicsService
      • Players
      • Ray
      • TweenService
    • compiler
    • math
    • os
    • string
    • table
    • retrostudio
  • Advanced Information
    • Instance Functions
    • Global Functions
    • Multithreading
    • Compiler Library
Powered by GitBook
On this page
  • Inserting Visual Scripting Blocks
  • Querying the Powerlang version and credits
  1. Advanced Information

Compiler Library

PreviousMultithreading

Last updated 7 months ago

The compiler library is a library unique to Powerlang that allows you to interact with the compiler. Using this library you can inject raw code, and obtain the current version of Powerlang, as well as credits. You can check out all functions it offers by going to its documentation page: compiler

This library is handy when you need to use a block present in RetroStudio that hasn't been added to Powerlang yet, or when doing optimization.

Inserting Visual Scripting Blocks

The compiler library has two functions to insert raw Visual Scripting blocks: InsertBlock and InsertBlockConnectedLast. The former creates a block that runs as its own statement, whereas the latter is connected to the last block generated by the compiler. It is possible to use InsertBlockConnectedLast to create chains of Visual Scripting blocks. Below is a visual representation of both methods:

For separate statements, it is recommened to use InsertBlock instead of InsertBlockConnectedLast right after another line, as InsertBlockConnectedLast might be impacted by if/else statements or loops.

The syntax of both commands is the same and it's:

Output = compiler.InsertBlock(BlockName, BlockID, ...)

BlockName is the friendly name of the block, it must be unique. BlockID identifies the type of the block, e.g. the ID Addition corresponds to the Addition block. Block IDs can be found in ProgrammingBlocksData.lua in the Powerlang source.

Due to Powerlang limitations, an inserted block can only have one output.

Here's an example of inserting an Addition block to add 60 and 9:

Result = compiler.InsertBlock("Add", "Addition", 60, 9)

IDs of all blocks (use Ctrl+F)

FindFirstChild HideLeaderboard IsStudio TeleportPlayerToPosition RemoteRecieveClient2 AnyPropertyChanged ActivateTool CloneObject DestroyObject TableRemove IsTouching SaveInstance DumpMemory GUIMouseMoved ToWorldSpace1 BreakLoop Color3ToHSV ConstructCFrame CreateTable Exponentiation WhileLoop2 ContinueLoop BindableFunctionOnInvoke TypeOf GUIRightMouseButtonDown RegisterCollisionGroup HasGamepass DialogChoiceSelected RightMouseUpLocal MutePlayer GSubString SetPartPhysicalProperties CreateLeaderstat GUILeftMouseButtonDown AND SetMouseTargetFilterLocal InsertModel BindableRecieve2 If KickPlayer BindableRecieve FromAxisAngle LoopThroughTable Warn DescendantAdded Print GetChildren GetLength ToolEquipped LoadVariable ConstructVector2 TweenGuiPosition IsAncestorOf ResumeSound RemoteRecieveClient LoopThroughChildren ToEulerAnglesXYZ CombineNumberWithString RemoteFunctionOnInvokeClient SetVariable CheckIfPlayerIsBanned OsClock InsertRetrostudioAvatar TweenGuiSize WhileLoop3 ForLoop2 StopSound SetMouseIconLocal HumanoidFreeFalling RandomBrickColor Color3ToBrickColor RotationBetweenPoints Addition SplitCFrame IsDescendantOf ExecuteFunction GetModelBoundingBox SplitNumberRange GetServerTimeNow ChildRemoved HumanoidSeated HSVToColor3 HumanoidRunning ToolUnequipped ToStringAny UnbanPlayer Vector3Dot RenderStepped SetNetworkOwner GetUserIdFromNameAsync PlayerRemoving LoopThroughDescendants TableInsert FilterString OR ReverseMortalityEngine LoadCharacter MathPi BodyPositionReachedTarget Substring SplitVector3 ClickDetectorInteraction SetCameraPositionLocal GetNameFromUserIdAsync PropertyChanged Vector3Cross GetObjectProperty IsA GetCameraPositionLocal RemoteFireAllClients GetMouseTargetSurface AbortRocketPropulsion KeyUpLocal Division GetConnectedParts GUILeftMouseButtonUp FunctionReturn TweenObjectProperty GetMouseTargetPartLocal GUIMouseWheelForward HumanoidJumping CheckToolEquipped GetMouseTargetPart ForLoop ExplosionHit LeftMouseUp GetTouchingParts TableFind PlayerAdded SplitColor3 LeftMouseDownLocal PartTouched SetVariable1 AddDebrisItem DefineFunction GUIMouseWheelBackward RemoteFunctionInvokeClient GiveBadge ToString HasBadge SplitUDim2 GetPartDirection DescendantRemoved SplitString MathLibrarySingleInput LeftMouseUpLocal ReloadPlace GUIMouseLeave LoadInstance LeaderstatChanged FindFirstChildWhichIsA HumanoidDied BindableFire2 TextBoxReleaseFocus TextBoxCaptureFocus ChattedSpecificMessage RemoteFireAllClients2 PerlinNoise ConstructVector3 BindToClose ChildAdded Round Chatted Angles WhileLoop BanPlayer HumanoidStateChanged GetPlayersOnTeam FromMatrix Modulus GiveRetrobux OsDate GetPlayerFromCharacter RemoteFunctionInvokeServer ExecuteBlock UnbanPlayerUID IsGameLoaded ToObjectSpace RemoteRecieveServer2 RemoteFireServer2 RemoteFireClient2 JsonEncode BreakJoints ToolActivated AssignCollisionGroup GetStudioSelection CharacterAdded GetRankInGroup IsInGroup PartTouchEnded IsFriendsWith RemoteFireServer IsTouchscreen SetCoreGuiEnabled IsPlayingSolo GetMouseTargetSurfaceLocal GUIMouseEnter SetBodyGyroDirection ToWorldSpace GetMousePosition3DLocal SplitVector2 HumanoidMoveTo InversePositionAndRotation Lerp ToNumber Comment2 BlockThatMakesYourCharacterSentient Lower SetLeaderstat Upper FindString DistanceBetweenPoints NormalizeVector3 CollisionGroupSetCollidable DescendantRemoving ToolDeactivated GUIRightMouseButtonClick IsGuest TableAppend FindFirstChildOfClass GetLeaderstat MathLibraryTripleInput MathLibraryDoubleInput RandomNumber Multiplication Subtraction SetTableValue GUIRightMouseButtonUp SetModelPrimaryPartCFrame GetMousePosition2D JumpRequest TeleportToPlace ChangeHumanoidStateLocal CombineStringWithNumber GetMousePosition2DLocal KeyUp KeyDown JsonDecode RightMouseUp RightMouseDown LeftMouseDown GetCFrameDirection GetMousePosition3D TextBoxFocusLost TextBoxFocused KeyDownLocal WaitForChild MakeJoints RightMouseDownLocal RemoteFunctionOnInvokeServer GetHumanoidState ChangeHumanoidState TakeDamage BindableFunctionInvoke AddToLeaderstat PauseSound PlaySound MegaBlock FireRocketPropulsion GetPartPhysicalProperties ConstructColor3 Comment MoveModelTo GUILeftMouseButtonClick BindableFire OsTime RemoteFireClient GetDescendants GetRandomChild SetObjectProperty CreateObject Lerp1 FindPartOnRay ConstructUDim2 ToObjectSpace1 InverseCFrame1 BrickColorToColor3 Concatenate ConstructNumberRange HumanoidMoveToFinished RemoteRecieveServer SortTable Wait GetRobloxVersion ComputePath DoNotRun GetTableValue GetTableLength Heartbeat SaveVariable NOT

Querying the Powerlang version and credits

It is helpful for shared scripts to know what version of Powerlang they're running on.

The Powerlang version can be obtained using compiler.version(). It returns a string containing the version. So, doing print(compiler.version()) will output Beta 0.9 as of the time of writing this article.

The Powerlang credits can be obtained similarly using compiler.credits(). Doing print(compiler.credits()) will result in the following output:

Powerlang - The Ultimate Programming Language
(c) vopwn55, 2024

Special thanks to:
NicePotato - Being a good friend
RJAI - Emotional Support

Both the Version and Credits are StringValues located in the root of the Powerlang source code folder.