📄️ String Indexing
You can index strings for their characters now, which is cleaner & 3x faster than using string.sub. String indexing only occurs when you index with an integer, either positive or negative. Positive integers index from the start of the string, and negative integers index from the end.
📄️ Numeral Parsing
Pluto makes two small changes to numeral parsing.
📄️ Break Statement
This keyword accepts an optional integral argument which tells it how many levels of enclosing loops it should break. The default value is 1, thus breaking out of the current loop.
📄️ Continue Statement
Continue statements, like break, are meant to be used in loops. They skip the current iteration of the loop.
📄️ Lambda Expressions
Lambda expressions are shorthand function objects for evaluating quick expressions. Take this code:
📄️ Table Freezing
Tables can now be frozen at their current state to forbid any future modification. This action is irreversible and permanent for the lifespan of the table.
📄️ Export Modifier
The export modifier allows you to automatically aggregate things you want to export into a table.
📄️ String Interpolation
String interpolation is a simple alternative syntax to concatenation.
📄️ Ternary Expressions
Ternary expressions behave identical as to how they would in C. They introduce no new keywords.
📄️ Enumerations
Pluto adds the following syntax:
📄️ For-As Loop
When you only want to iterate over the values of a table, you can use Pluto's for-as syntax.
📄️ Switch Statement
The switch statement consists of the following new keywords:
📄️ Default Arguments
During a function declaration, parameters can now declare their own default value.
📄️ Named Arguments
Instead of positional arguments, you can use the names of arguments you want to set:
📄️ Type Hinting
Type-hinting looks like this:
📄️ In Expressions
Searching a string for a substring, or searching an array for an element is a very simple operation now. The in operator has been extended to support these operations.
📄️ Named Varargs
If you have a function that takes varargs and you want them in a table, you'd have to do something like this:
📄️ Destructuring
Destructuring is a better way to assign local variables from expressions that return a table.
📄️ Constexpr Attribute
Pluto adds the ` attribute which is a strengthened version of the ` attribute.
📄️ Safe Navigation
Accessing deeply nested fields which can potentially be nil was problematic, because you'd need an unreasonable amount of guard clauses to prevent an "attempt to index nil" error. Pluto now offers this syntax:
📄️ Compile-Time Evaluation
Pluto's parser provides some powerful constructs which allow you to write code that will never be seen at runtime.
📄️ Compiler Warnings
Pluto offers optional compiler warnings for certain misbehaviors.
📄️ Object-Oriented Programming
Pluto makes a plethora of improvements when it comes to object-oriented programming.