Thomas Jericke

lua-users home
wiki

Difference (from prior major revision) (minor diff)

Removed: 1d0


Changed: 4c3
This page is used to distribute patches that I made in my private time. They should be tested by anyone who is appliying them as I never tested any of them on productive Lua code.
This page is used to distribute patches that I made in my private time. They should be tested by anyone who is applying them as I never tested any of them on productive Lua code.

Added: 5a5
It is important to consider that this patches are more for fun (yet).

Added: 6a7
Currently there is one patch available:

Changed: 9c10
This patch makes many of the brackets (Parentheses ) which don't add any information to the code optional.
This patch makes many of the brackets ( Parentheses ) which don't add any information to the code optional.

Changed: 27c28

}}}

Added: 30a32
{{{

Added: 32a35
}}}

We use Lua in our automation framework McRobot?[1]

This page is used to distribute patches that I made in my private time. They should be tested by anyone who is applying them as I never tested any of them on productive Lua code.

It is important to consider that this patches are more for fun (yet).

Currently there is one patch available:

Optional redundant brackets

This patch makes many of the brackets ( Parentheses ) which don't add any information to the code optional.

In the current version of the patch, brackets the following brackets can be left away. Method call without any arguments:

 
object:method 
-- equals
object:method()

Method invocation on any literal (string, number, true, false, nil)

"Hello":upper
-- equals
("Hello"):upper()
43:tostring
-- equals
(43):tostring()
Obviously this change is only practical once a meaningful metatable was set for string, number etc.

Operators on tables (except call operator)

a = { a = 12 }.a 
b = { 1 = 14, 12 = "t" }[a]

The patch should be backward compatible for existing Lua 5.2 scripts. This was tested with the Lua test suite where it passed all test with exception of some which tested an error output.

[Download for 5.2.2)]


RecentChanges · preferences
edit · history
Last edited May 21, 2014 9:18 pm GMT (diff)