lua-users home
lua-l archive

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


In Lua 5.3, this code is unparseable:
```
function huh() 1 end
```
Would it be possible in future versions of Lua to instead make it return `1` when called, i.e. to permit a final optional _expression_? AFAIK this wouldn't break anything since the above statement can't be parsed anyways.

Proposed example:
```
function huh() 1 end
print(huh()) -- prints 1
```

The motivation for this is lua configuration files.
Example:
`conf.lua`
```
-- statements...
{
option1=1;
option2=2;
}
```
The desired process is that the above block would be `load`ed and operated on.
As of current the above code block does not parse, and it would be nice if it did.

Previous discussion I found:
http://lua-users.org/lists/lua-l/2001-04/msg00264.html

Thanks,
Andrew