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 » Scripting Helpers
Home Search
 

A Helpful Tip

Previous Thread :: Next Thread 
fireblade2 is not online. fireblade2
Joined: 18 Nov 2007
Total Posts: 4666
30 Jan 2012 03:04 PM
Consider the following code:


function test(x,y)
if x > y then
return true
else
return false
end
end

val1 = 25
val2 = 17

test(val1,val2)



Well, that's one way of accomplishing it, but here's another:


function test(x,y)
return x > y
end

val1 = 25
val2 = 17

test(val1,val2)



I hope this helped.
Report Abuse
Cyrok is not online. Cyrok
Joined: 11 Jan 2012
Total Posts: 630
30 Jan 2012 03:10 PM
i dun understand

explain whole thing

{ Learning normal Lua and RBX.Lua. }
Report Abuse
fireblade2 is not online. fireblade2
Joined: 18 Nov 2007
Total Posts: 4666
30 Jan 2012 03:15 PM


function test(x,y)
if x > y then -- If the statement 'x > y' is true
return true -- return true
else -- If the statement 'x > y' is false
return false -- return false
end
end

val1 = 25
val2 = 17

test(val1,val2)


The code below does the same exact thing, except in a more efficient way:

function test(x,y)
return x > y --This returns either 'true' or 'false', it does the same thing as the ---above function
end

val1 = 25
val2 = 17

test(val1,val2)
Report Abuse
Cyrok is not online. Cyrok
Joined: 11 Jan 2012
Total Posts: 630
30 Jan 2012 03:19 PM
explain everything over again

i cant seem to get it

{ Learning normal Lua and RBX.Lua. }
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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