LAU Syntax & Variables
Lau is an easy-to-write and readable language. You don’t need to put semicolons (;) at the end of lines. The Lau language is designed being inspired by the Lua language.
Comments
Section titled “Comments”Use comments to leave notes in your code. The system ignores these lines.
-- This is a single-line comment.varol x = 1 -- Code is here.
--[[This is a multi-linecomment block.]]Reserved Words
Section titled “Reserved Words”The following words belong to the language itself and cannot be used as variable names:
varol, func, if, else, elseif, then, end, for, while, do, break, continue, return, req, true, false, null, inpairs, and, or, not
Example - Incorrect vs Correct:
-- ERROR! This code will not work:varol if = 5
-- CORRECT:varol ifStatus = 5Character Rules (Important)
Section titled “Character Rules (Important)”Inside Lau, Turkish Characters (ö, ğ, ş, ç, ı, ü), Emojis, and special characters are strictly forbidden. These characters cannot be read by the system and will be replaced by a "?" sign, which causes the code to break and error out.
-- ERROR! Unreadable and results in a "?" error:varol lauöğreniyorum = 2
-- CORRECT:varol learningLau = 2Block Termination (end)
Section titled “Block Termination (end)”In the Lau language, code blocks (if, for, while, func) are not defined by curly braces ''. Instead, they must always be closed using the end keyword. Every structure you open with then or do requires a matching end.
When you place a block inside another (Nested), each block must have its own end. The first end closes the innermost block, and the last end closes the outermost block.
varol energy = 100varol isMoving = true
-- Outer block startsif energy > 0 then -- Inner block starts if isMoving == true then print("Robot is moving and has energy.") end -- Closes inner 'if'end -- Closes outer 'if'
-- This rule applies to all structures:for i = 1, 3 do while true do break end -- Closes whileend -- Closes forVariables (varol)
Section titled “Variables (varol)”Variables store information. In LAU, every new variable must start with the varol keyword.
varol name = "Lau" -- String (Text)varol level = 5 -- Numbervarol active = true -- Boolean (Logical)varol list = {1, 2, 3} -- List
-- Value updatelevel = 6level += 1 -- (Same as level = level + 1)print(level)varol crop, wheatPrice = "Wheat", 20 -- it does this all in order so crop = "Wheat" and wheatPrice = 20
print(crop + " costs " + wheatPrice)Data Types
Section titled “Data Types”Lau supports the following data types:
- Number: Whole or decimal numbers. Square roots or factorials of negative numbers cannot be calculated.
- String: Texts within double quotes. Maximum 10,000 characters. Automatically performs concatenation when added with numbers (
"Lau " + 2). - Boolean: Takes only
trueorfalsevalues. Used in decision mechanisms (if). - List: Ordered (Array) or keyed (Dictionary) boxes that can hold up to 5,000 elements.
- Enum: E.g.,
Enum.Direction.North. Can only be checked for equality with other Enums in its own category. - Null: Represents empty data with no value.
Arithmetic Operators (Math)
Section titled “Arithmetic Operators (Math)”Used to perform mathematical operations with numbers:
| Operator | Action | Example | Result |
|---|---|---|---|
+ | Addition | 5 + 3 | 8 |
- | Subtraction | 10 - 4 | 6 |
* | Multiplication | 3 * 4 | 12 |
/ | Division | 20 / 2 | 10 |
^ | Exponentiation | 2 ^ 3 | 8 |
% | Modulo/Remainder | 10 % 3 | 1 |
# | Square Root | #4 | 2 |
varol x = 10varol y = 5varol result = (x + y) * 2 -- Parentheses have priorityprint(result) -- Prints 30Comparison Operators
Section titled “Comparison Operators”Compares two values and returns true or false as a result:
| Operator | Meaning |
|---|---|
== | Equals |
~= | Not Equal |
< | Less Than |
> | Greater Than |
<= | Less Than or Equal |
>= | Greater Than or Equal |
varol energy = 100if energy == 100 then print("Energy is full!")end
if energy ~= 0 then print("Still working...")endAssignment and Update Operators
Section titled “Assignment and Update Operators”The Lau language has special ‘and Assign’ operators to shorten operations:
| Operator | Meaning | Example |
|---|---|---|
= | Standard Assignment | x = 5 |
+= | Add and Assign | x += 1 (same as x = x + 1) |
-= | Subtract and Assign | x -= 5 |
*= | Multiply and Assign | x *= 2 |
/= | Divide and Assign | x /= 2 |
^= | Power and Assign | x ^= 2 |
%= | Modulo and Assign | x %= 3 |
varol score = 0
-- Long wayscore = score + 10
-- Shorthand (Lau Style)score += 10
print(score) -- Prints 20Logical Operators
Section titled “Logical Operators”LAU uses uppercase keywords for logical operations.
| Operator | Meaning |
|---|---|
AND | Returns true if both conditions are true |
OR | Returns true if at least one condition is true |
NOT | Reverses the logical value |
varol hasSeeds = truevarol freeSpot = false
if hasSeeds AND freeSpot then print("Ready to plant!")end
if hasSeeds OR freeSpot then print("At least one condition is true!")end
varol isLocked = trueif NOT isLocked then print("Unlocked!")endLogical Short-Circuit (Default Values)
Section titled “Logical Short-Circuit (Default Values)”In the Lau language, the OR operator works in a very specific way: If the value on its left is null or false, it looks at the value on its right.
If the value on the left is ‘truthy’ (not null or false), it selects it without ever looking at the value on the right. This method is used to assign a Default Value.
-- 1. Assigning a Default Valuevarol enteredName = nullvarol name = enteredName OR "Guest"print(name) -- Output: "Guest" (Because enteredName is null)
-- 2. If Value Existsvarol registeredName = "A1fi_e"varol user = registeredName OR "Anonymous"print(user) -- Output: "A1fi_e" (Because it's not null)
-- 3. Using Notvarol active = falseprint(NOT active) -- Output: trueFile Pragmas (special comments)
Section titled “File Pragmas (special comments)”Some scripts may include special file-level comment directives (pragmas) that change runtime behavior. The most commonly encountered one in LAU docs is the --!ndrone pragma.
--!ndrone: When present at the top of a script, this directive disables real-world drone control for that script. This is useful for examples and tests where you want to execute code and show printed output without moving the drone.
Example (will print but not move the drone):
--!ndrone
drone.move(Enum.Direction.South)print(1 + 1)