continue statement
|
Author |
Message |
asafp
Member
  
Posts: 81
Group: Registered
Joined: Jan 2008
Status:
Offline
Reputation: 0
|
continue statement
Lua has a break statement, but no continue like is commonly found in other languages. There are several references to this out there if you do a google search. One basically says it's not essential, which is true. On the other hand, it sure would be nice and it's not something that can be implemented by simply writing a lua function.
There's at least two places where the source code has already been done. I don't know if they actually work properly.
BLUA: bastardized lua
Lua Power Patches
I'm assuming this wouldn't add much to the size of the executable file.
|
|
08-09-2008 02:01 PM |
|
 |
JohnMurga
Administrator
      
Posts: 381
Group: Administrators
Joined: Apr 2007
Status:
Offline
Reputation: 2
|
RE: continue statement
OK, It's in ...
Hopefully a 0.6.X series build for this weekend with quite a lot of updates and fixes.
I am currently working on 0.7.X which does have some radical changes (under the hood, not affecting compatibility), and that's making things a little complicated ... 0.7.0 won't be out for a long time.
Cheers
JohnM
|
|
08-11-2008 09:01 PM |
|
 |
asafp
Member
  
Posts: 81
Group: Registered
Joined: Jan 2008
Status:
Offline
Reputation: 0
|
RE: continue statement
Thanks, John. murgaLua rocks!
|
|
08-12-2008 10:41 AM |
|
 |
znarf
Junior Member
 
Posts: 34
Group: Registered
Joined: Jun 2007
Status:
Offline
Reputation: 0
|
RE: continue statement
Although I won't recommend using a statement that is not part of standard Lua (and will never be), I'm pleased to see murgaLua evolving.
In any case I'm looking forward to the next release, may it be this weekend or a subsequent one (just extrapolating experiences from prior announcements... )
|
|
08-13-2008 08:57 PM |
|
 |
mikshaw
Senior Member
   
Posts: 522
Group: Registered
Joined: Apr 2007
Status:
Offline
Reputation: 5
|
RE: continue statement
Just curious....I don't understand what the benefit is. Not only does it seem nonessential, but it seems to serve no unique purpose at all. This is assuming continue merely jumps ahead to the next iteration, and doesn't have any other special use.
The Lua language already provides the same behavior, only in a passive way. Rather than specifically skipping the rest of a loop under a certain condition, you simply *don't* skip when that condition doesn't exist.
Or at least that's how I understand it =o)
|
|
08-14-2008 12:29 AM |
|
 |
asafp
Member
  
Posts: 81
Group: Registered
Joined: Jan 2008
Status:
Offline
Reputation: 0
|
RE: continue statement
Say you have a loop where you are reading through a database. Some records require extensive processing, some minimal processing, and some no processing at all. The conditions for checking which level of processing is required are complex. The continue statement allows you to do this in a gracious manner by avoiding hellacious nested if statements.
|
|
08-15-2008 03:32 PM |
|
 |
JohnMurga
Administrator
      
Posts: 381
Group: Administrators
Joined: Apr 2007
Status:
Offline
Reputation: 2
|
RE: continue statement
Either way ... It is a feature that I have missed myself (coming from other languages) ...
So I conclude that it allows you write code without having to re-think your logic with Lua in mind, so it's a good thing :-)
Cheers
JohnM
|
|
08-15-2008 10:47 PM |
|
 |