Added point about line terminators

pull/168/head
Dibyendu Majumdar 5 years ago committed by GitHub
parent dca547868d
commit a70a8c3dde
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -11,6 +11,7 @@ Key Features of Lua
* Lua versions matter
* Lua is dynamically typed like Python
* By default variables in Lua are global unless declared local
* Lua has no line terminators
* There is a single complex / aggregate type called a 'table', which combines hash table/map and array features
* Functions in Lua are values stored in variables; in particular functions do not have names
* Globals in Lua are just values stored in a special Lua table
@ -83,6 +84,19 @@ There are some exceptions to the rule:
* the iterator variables declared in a ``for`` loop are implicitly local.
* function parameters are local to the function
Lua has no line terminators
===========================
Strictly speaking you can terminate Lua statements using ``;``. However it is not necessary except in some cases to avoid ambiguity.
This design has some consequences that took me by surprise::
local x y = 5
Above creates a local variable ``x`` and sets a global ``y`` to ``5``. Because it actually parses as::
local x
y = 5
The 'table' type
================
Lua's only complex / aggregate data type is a table. Tables are used for many things in Lua, even internally within Lua.

Loading…
Cancel
Save