goto statements and labels for control flow.
Feature Flag
Version-Specific Nodes
Goto
A goto statement that jumps to a label. Location:full_moon::ast::lua52::Goto
Methods
new(label_name: TokenReference) -> Self- Creates a new Goto with the given label namegoto_token(&self) -> &TokenReference- Thegotosymbollabel_name(&self) -> &TokenReference- The label namewith_goto_token(self, goto_token: TokenReference) -> Self- Returns a new Goto with the givengototokenwith_label_name(self, label_name: TokenReference) -> Self- Returns a new Goto with the given label name
Example
Label
A label that marks a position for goto statements. Location:full_moon::ast::lua52::Label
Methods
new(name: TokenReference) -> Self- Creates a new Label with the given nameleft_colons(&self) -> &TokenReference- The::symbol on the leftname(&self) -> &TokenReference- The label nameright_colons(&self) -> &TokenReference- The::symbol on the rightwith_left_colons(self, left_colons: TokenReference) -> Self- Returns a new Label with the given left colonswith_name(self, name: TokenReference) -> Self- Returns a new Label with the given namewith_right_colons(self, right_colons: TokenReference) -> Self- Returns a new Label with the given right colons
Example
Usage
Notes
- Labels must be enclosed in double colons:
::label:: - Goto statements can only jump to labels within the same function scope
- You cannot jump into the scope of a local variable
- Lua 5.2 also includes other features like
\zescape sequences in strings and fractional hexadecimal numbers, which are automatically supported when thelua52feature is enabled