lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

There's a sample in metalua which uses indentation to structure statement blocks. The extension is here:

And here's an example of a program using it:
-- This file requires an alternative lexer, therefore it must be
-- compiled that way:
-- > mlc -x pythonic.lua pysample.lua
-- Or, if you want to execute it right away:
-- > mlc -x pythonic.lua -x pysample.lua

print "Eratosthenes' Sieve, in pythonic Metalua:"

function print_sieve (limit):
local sieve, i = { }, 2
while i<limit:
while sieve[i]:
i=i+ 1
for j = i*i, limit, i:
sieve[j] = true


In case there are issues with indentation through mail (one of the reasons why I'm no fan of significant whitespaces in real-life conditions), it's also available at