|
| 20 Jun 2015 12:49 AM |
Why does lua not have a continue statement
:( |
|
|
| Report Abuse |
|
|
ShungTzu
|
  |
| Joined: 14 Jun 2014 |
| Total Posts: 959 |
|
| |
|
|
| 20 Jun 2015 12:56 AM |
while wait() do --continue would stop there like a break, but go back for more iterations
if(ResultsNotAsExpectedThisRun)then continue end
do stuff here
end |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 20 Jun 2015 01:00 AM |
| Well you can just do if not (condThatWillCauseBreak) |
|
|
| Report Abuse |
|
|
Rindyr
|
  |
| Joined: 30 Apr 2013 |
| Total Posts: 75 |
|
|
| 20 Jun 2015 01:30 AM |
| Lua has a goto keyword, which Roblox does not support. Lua assumes that you can just use that instead of a continue keyword. Like I said though, roblox doesn't support it. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 20 Jun 2015 01:40 AM |
No, that's not why. Goto is new, it never existed in Lua 5.1 which Roblox uses. |
|
|
| Report Abuse |
|
|
|
| 20 Jun 2015 01:42 AM |
I don't need my while true do broken... I need to skip just one iteration D: |
|
|
| Report Abuse |
|
|
ShungTzu
|
  |
| Joined: 14 Jun 2014 |
| Total Posts: 959 |
|
|
| 20 Jun 2015 02:02 AM |
| Is thee an equivalent to while true in javascript? |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
| |
|
| |
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 20 Jun 2015 02:12 AM |
| Oh I thought he said it the other way around D; |
|
|
| Report Abuse |
|
|
ShungTzu
|
  |
| Joined: 14 Jun 2014 |
| Total Posts: 959 |
|
|
| 20 Jun 2015 02:12 AM |
| Is there anything you can do with continue that you can't do with that? |
|
|
| Report Abuse |
|
|
lordrambo
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 20628 |
|
|
| 20 Jun 2015 02:31 AM |
| This can be accomplished with an if statement. It's by no means preferable but it is what it is. It's unfortunate that there's no goto or continue for us. There's also no goto in java but they keyword is reserved. Was disappointing. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 20 Jun 2015 02:56 AM |
| Goto's are so great, I can't believe they don't support them in Java -.- |
|
|
| Report Abuse |
|
|
|
| 20 Jun 2015 09:25 PM |
Goto is completely procedural. It isn't recommended to be placed in a OOP setting.
Yes there are certain things that continue can do...
while true do if(condition)then continue end
-- Do stuff
end
Instead of...
while true do if(condition)then
end end
and it gets really annoying with this version as...
while true do --this happens too much and the block code format is o.o if(condition)then if(condition)then if(condition)then for i=1, 10 do if(condition)then if(condition)then if(condition)then
end end end end end end end end
|
|
|
| Report Abuse |
|
|
|
| 20 Jun 2015 09:27 PM |
"Goto is completely procedural. It isn't recommended to be placed in a OOP setting."
Why not? Isn't there an instruction for Goto in Assembly? |
|
|
| Report Abuse |
|
|
|
| 20 Jun 2015 09:27 PM |
| Oh, and Lua isn't very OOP. |
|
|
| Report Abuse |
|
|
|
| 20 Jun 2015 09:32 PM |
Lua is entirely OOP.
It works with the backend programming language more than you see.
Goto is kindof required in assembly, as it isn't OOP and it controls jumping around to different parts of code. |
|
|
| Report Abuse |
|
|
|
| 20 Jun 2015 09:39 PM |
I feel like in the case of roblox, if you really have to do something like this, then you are just making it too complicated on yourself.
What exactly are you trying to do?
|
|
|
| Report Abuse |
|
|
lordrambo
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 20628 |
|
|
| 20 Jun 2015 09:44 PM |
"Lua is entirely OOP.
It works with the backend programming language more than you see."
Lua runs standalone too so it isn't working with any backend language there. Anything that's being done with the backend language isn't Lua or at least isn't just Lua. I don't really know what you're referring to however. Lua for certain isn't very OOP and lacks a lot of the things full-OOP languages have. |
|
|
| Report Abuse |
|
|
lordrambo
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 20628 |
|
|
| 20 Jun 2015 09:45 PM |
| Also it can be done with an if statement (probably) but I feel like you don't have a specific problem, you'd just like the extra feature to make things easier I think. |
|
|
| Report Abuse |
|
|
|
| 20 Jun 2015 09:49 PM |
"Multi-paradigm: scripting, imperative (procedural, prototype-based object-oriented), functional"
Now referring to Roblox-specific.
It isn't very Object-Oriented at all anyways. Think of the basic data types: Can you extend them? No. Do they have members? Except for strings, no.
Is there an easy way to declare and extend classes? No.
It even uses a SPECIAL SYNTAX for methods as members of classes! It looks to me like that was added after Lua was released!
|
|
|
| Report Abuse |
|
|
lordrambo
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 20628 |
|
|
| 20 Jun 2015 09:54 PM |
| Can you even inherit with Lua-sided objects? I don't use this language or website enough anymore to know but I remember people saying on this forum a year or so ago before it became the help center of ROBLOX that it didn't. |
|
|
| Report Abuse |
|
|
|
| 20 Jun 2015 10:00 PM |
"Lua runs standalone too so it isn't working with any backend language there. Anything that's being done with the backend language isn't Lua or at least isn't just Lua. I don't really know what you're referring to however. Lua for certain isn't very OOP and lacks a lot of the things full-OOP languages have."
Lua is >nothing< without the backend language running its code.
public class Vec3 {
}
local Instance.new = function() return luajava.newInstance("com.package.LuaStuff.Vec3") end
Lua is made to be delt in into the language it is running on. In this case java, in other cases hardcore C# and C++. Take a look at most the website's examples... it has to deal with what I am talking about.
--------
@Jarod
local Object = {}
Object.new = function(param1) local this = {Example = param1}
this.example_function = function()
end
return this end
return Object -- OOP in Lua
local Enum = {}
Enum.A = 1 Enum.B = 2 -- etc.
return Enum
-- Extending two classes
local Class1 = {} local Class2 = {}
for i, v in pairs(Class2)do Class1[i] =v end
----------------------
Actually, if you never written with Lua in a Language + vanilla Lua (no moonscript or game engine bs) then you would see how much I am right.
Since you obviously haven't, I am not going to waste anymore time.
|
|
|
| Report Abuse |
|
|
nomer888
|
  |
| Joined: 13 Feb 2010 |
| Total Posts: 551 |
|
|
| 20 Jun 2015 10:29 PM |
| Cody, Lua is a lightweight programming language generally used for scripting. It's not entirely OO, nor does it need a continue statement. Continue is not necessary and can be considered bloat due to the ability to work without it. Continue enables lazy programming, which can in turn lead to a whole slew of bad habits. |
|
|
| Report Abuse |
|
|