[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: new thought experiment: what would you add to Lua ?
- From: Scott Morgan <blumf@...>
- Date: Wed, 26 Sep 2018 16:46:05 +0100
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