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
 

One line for loops (or if statements/anonymous functions)

Previous Thread :: Next Thread 
DJ3SkullsOfficial is not online. DJ3SkullsOfficial
Joined: 05 Oct 2014
Total Posts: 101
25 Sep 2016 04:50 PM
Here's an example, can this work or not?

for _, v in pairs(game.Workspace:GetChildren()) do print(v.Name) end


Is this what you're looking for?
Report Abuse
iIikeyou is not online. iIikeyou
Joined: 07 Mar 2012
Total Posts: 1659
25 Sep 2016 04:52 PM
table.sort(tab,print)

true hack
Report Abuse
Wunder_Wulfe is not online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
25 Sep 2016 04:54 PM
you always could put everything in one line because lua reads things based off of the ; character or any whitespace
Report Abuse
DJ3SkullsOfficial is not online. DJ3SkullsOfficial
Joined: 05 Oct 2014
Total Posts: 101
26 Sep 2016 11:37 AM
@iIikeyou, @Wunder_Wulfe

Appreciated. Thank you.


Is this what you're looking for?
Report Abuse
Wunder_Wulfe is not online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
26 Sep 2016 11:38 AM
another example:

print("hi") print("there")

print("hi"); print("there");

print("hi");print("there");
Report Abuse
DJ3SkullsOfficial is not online. DJ3SkullsOfficial
Joined: 05 Oct 2014
Total Posts: 101
26 Sep 2016 11:40 AM
@Wunder_Wulfe

I've seen that type of syntax being used before, isn't that to issue a new command on the same line?


Is this what you're looking for?
Report Abuse
Wunder_Wulfe is not online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
26 Sep 2016 12:12 PM
; will just force the line to end
print("hi" .. "\n" .. "yo")
print("hi");
print("yo");
print("hi");print("yo")

print("hi "; .. "\n" .. "yo")
this will not work because the line ends
Report Abuse
DJ3SkullsOfficial is not online. DJ3SkullsOfficial
Joined: 05 Oct 2014
Total Posts: 101
26 Sep 2016 12:14 PM
@Wunder_Wulfe

Oh, so the semi-colon is basically a non-loop break?


Is this what you're looking for?
Report Abuse
Wunder_Wulfe is not online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
26 Sep 2016 12:17 PM
no

It forces
A
Line
To end

print("hi");print("there")
==
print("hi")
print("there")
Report Abuse
JetUpNy is online. JetUpNy
Joined: 18 Feb 2016
Total Posts: 258
26 Sep 2016 05:36 PM
Any idea how to print 1 letter at a time, like an old school computer prompt or 1 complete word at a time in a sentence?

Like H then e then l then l then o; and it reads Hello.
Report Abuse
iIikeyou is not online. iIikeyou
Joined: 07 Mar 2012
Total Posts: 1659
26 Sep 2016 05:39 PM
not quite accurate
print("hi "
.. "\n" .. "yo")

works fine

print("hi "; .. "\n" .. "yo")

does not
Report Abuse
iIikeyou is not online. iIikeyou
Joined: 07 Mar 2012
Total Posts: 1659
26 Sep 2016 05:44 PM
local function Print(...)
for _,v in ipairs{...}do
if tostring(v)then
for i in tostring(v):gmatch'.'do
print(i)
end
end
end
end
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