|
| 14 May 2012 04:27 PM |
I've had a lot of questions lately. Okay so lets say you have a loop like this: for i = 0,1,0.1 Instead of i could you do i2 or b or whatever? |
|
|
| Report Abuse |
|
|
|
| 14 May 2012 04:30 PM |
You can make it whatever you want, as long as it's a valid variable.
for LOL_ThisIsWeird = 1,12 do print(LOL_ThisIsWeird) end |
|
|
| Report Abuse |
|
|
|
| 14 May 2012 04:34 PM |
Or you can leave it unspecified
for _ = 1, 2 do print("Hi!") end
> Hi! > Hi! |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 14 May 2012 04:34 PM |
Creator of thread:
you don't need to worry about the variables name. It's just the variable. Its what matters what you do with it.
Think of it like math. You're solving a problem.
x = 2
5*x = 10
True. Does it have to be x? No, it doesn't
numbert = 2 5*numbert = 10
evaluates true.
Although, if you wanna be a professional one day name your variables as realistic as you can. |
|
|
| Report Abuse |
|
|
|
| 14 May 2012 04:35 PM |
| Now heres a crazy question, can you call a function from another script? |
|
|
| Report Abuse |
|
|
|
| 14 May 2012 04:37 PM |
You can use BindableFunction (Object) and take a use of :Invoke() and :OnInvoke() Or you could store the function as a global, and make the other script call the global function
_G.Function1 = function(val) print(val) end
_G.Function1("hi there!") > "hi there!" |
|
|
| Report Abuse |
|
|
|
| 14 May 2012 04:38 PM |
| So you assign a global variable to a function? |
|
|
| Report Abuse |
|
|
|
| 14 May 2012 04:41 PM |
This is a For statement, in "function form":
function For(Start, Stop, Step, Exec) if Start < Stop and Step <= 0 then return end if Start > Stop and Step >= 0 then return end Exec(Start) For(Start+Step, Stop, Step, Exec) end
For( 1, 10, 2, print )
> 1 3 5 7 9
|
|
|
| Report Abuse |
|
|
|
| 14 May 2012 04:43 PM |
Anyway, back to being on topic ....
When using a for loop, you can use whatever variable you'd like. People love using single-character variables for that kind of stuff, simply because it's faster to type. |
|
|
| Report Abuse |
|
|
|
| 14 May 2012 04:44 PM |
| @miz - I'm going to take you literally, and point out that in mathematics, variables are always one letter, and one letter only. :D |
|
|
| Report Abuse |
|
|
|
| 14 May 2012 04:47 PM |
@ElectricBlaze
Technically, using substitution, you still get 10. This is because we assigned the product of n, u, m, b, e, r, and t as 2. ;P |
|
|
| Report Abuse |
|
|
|
| 14 May 2012 04:49 PM |
| If you separate each letter into a different variable, then yes. But what's the fun in that? |
|
|
| Report Abuse |
|
|
|
| 14 May 2012 04:51 PM |
Go on, find the values of n, u, m, b, e, r, and t. There's the fun. :)
n = 6 u = 4 m = 0.5 b = 0.5 e = 1 r = 1/6 t = 2 |
|
|
| Report Abuse |
|
|
|
| 14 May 2012 04:52 PM |
| Nah, that's boring. Try three dimensional quadratic equations. Now THAT is fun. :) |
|
|
| Report Abuse |
|
|
|
| 14 May 2012 04:52 PM |
Ew. Just stick with vectors. |
|
|
| Report Abuse |
|
|
|
| 14 May 2012 04:56 PM |
| Quadratic Equations make me happy. c: |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 14 May 2012 05:00 PM |
While you guys do all the easy stuff I'm gonna try to figure out how to use x slopes and y slopes :P
So hard |
|
|
| Report Abuse |
|
|
|
| 14 May 2012 05:04 PM |
WHAT PLANET ARE YOU FROM? WERE YOU DROPPED ON YOUR HEAD AS A CHILD? MY GOSH, SIR.
x and y slopes =/= harder than quadratic equations
LOL. |
|
|
| Report Abuse |
|
|
|
| 14 May 2012 05:05 PM |
@miz
"So hard???"
y = 1/2x + 3
Man, I wish I sitll had problems like that.
I have conics:
(x+4)^2 + (y+16)^2 = 81
And that's pretty easy.
|
|
|
| Report Abuse |
|
|
| |
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 14 May 2012 05:12 PM |
>.>
Do you not know what sarcasm means? |
|
|
| Report Abuse |
|
|
|
| 14 May 2012 05:14 PM |
| It's hard to tell when something is meant sarcastically or not without hearing someone's voice, and as you gave no sign of sarcasm in your word choice, it had not crossed my own mind, and probably those of everyone else viewing this thread. |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 14 May 2012 05:17 PM |
Electricblaze. . .
As of a fact you still think it was real when it was just a prank I'm pretty sure you don't know what sarcasm means.
Ah, that was a funny day :P
|
|
|
| Report Abuse |
|
|
|
| 14 May 2012 05:18 PM |
| Nah, I just wanted an excuse not to re-add you on skyp3. |
|
|
| Report Abuse |
|
|
|
| 14 May 2012 05:20 PM |
| We just learned about slopes in math, It's really easy. |
|
|
| Report Abuse |
|
|