generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Lua Continue

Previous Thread :: Next Thread 
cody123454321 is not online. cody123454321
Joined: 21 Nov 2009
Total Posts: 5408
20 Jun 2015 12:49 AM

Why does lua not have a continue statement

:(
Report Abuse
ShungTzu is not online. ShungTzu
Joined: 14 Jun 2014
Total Posts: 959
20 Jun 2015 12:54 AM
What does it do?
Report Abuse
cody123454321 is not online. cody123454321
Joined: 21 Nov 2009
Total Posts: 5408
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 is not online. 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 is not online. 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 is not online. 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
cody123454321 is not online. cody123454321
Joined: 21 Nov 2009
Total Posts: 5408
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 is not online. 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 is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
20 Jun 2015 02:05 AM
while true do

end
Report Abuse
AbstractMadness is not online. AbstractMadness
Joined: 22 Dec 2014
Total Posts: 20425
20 Jun 2015 02:08 AM
while (true) { }
Report Abuse
cntkillme is not online. 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 is not online. 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 is not online. 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 is not online. 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
cody123454321 is not online. cody123454321
Joined: 21 Nov 2009
Total Posts: 5408
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
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
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
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
20 Jun 2015 09:27 PM
Oh, and Lua isn't very OOP.
Report Abuse
cody123454321 is not online. cody123454321
Joined: 21 Nov 2009
Total Posts: 5408
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
CloneTrooper1019 is not online. CloneTrooper1019
Joined: 19 Jan 2009
Total Posts: 6227
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 is not online. 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 is not online. 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
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
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 is not online. 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
cody123454321 is not online. cody123454321
Joined: 21 Nov 2009
Total Posts: 5408
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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image