Documentation
GitHubTwitter
  • overview
    • What is Lua++?
    • Why Lua++?
  • language improvements
    • Compound Assignments
    • Postfix and Prefix Operators
    • The Continue Statement
    • Constant Variables
    • Type Annotations
      • Function Annotations
    • Classes
      • Constructors
      • Templating
      • Inheritance
      • Encapsulation
    • Events
    • Macros
      • Lenient
      • Comment
      • C-Arrays
  • contributing
    • Installing the Project
Powered by GitBook
On this page

Was this helpful?

  1. language improvements
  2. Macros

C-Arrays

A rather new addition is the --!carrays macro. This macro forces the first element in arrays to start at 0 not 1 like usual. This macro was added for all those C-style programmers (and others) who can't stand this feature about Lua. The following code segment shows this macro in action:

--!carrays

local array: Array<number> = { 1, 2, 3 }

print(array[0])    -- Gets first element (1)
print(array[1])    -- Gets second element (2)
PreviousCommentNextInstalling the Project

Last updated 2 years ago

Was this helpful?