|
I believe that theoretically it might change the behavior of existing code, since if you have the following:```function foo()assert(do_something())end```Let's say that `do_something` returns a boolean indicating success or failure, and that result is asserted on. But assert returns its argument, so now that assert line is returning a value, which would then be returned from the function since it is the last _expression_ in the function, kind of like `1`. So previously the function returns nothing, and now with your feature it returns true (when it returns).DavidOn Sun, Jun 20, 2021 at 3:30 PM Andrew Yan <aky26@cornell.edu> wrote: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 endprint(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:Thanks,Andrew