lua-users home
lua-l archive

Re: new thought experiment: what would you add to Lua ?

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


On 14/09/2018 20:57, Jim wrote:
>
Some sugar maybe but something along the lines of:
 if item = find_something() then
 item:do_stuff()
 end
With `item` being local to the if scope, and not polluting the wider
block. So effectively it translates to this
 begin
 local item = find_something()
 if item then
 item:do_stuff()
 end
 end
Could probably do with it in while loops too.
Seems to flow with the for loop syntax, so not that wild an idea :)
Scott

AltStyle によって変換されたページ (->オリジナル) /