As8D
|
  |
| Joined: 24 Dec 2009 |
| Total Posts: 2907 |
|
|
| 22 Mar 2013 06:37 PM |
Oh, ty... New knowledge everyday. I will archive it in my library of ways to conquer the world, in my crystal-growing dark, magical-tree-filled empire of skeletons, Viking ships, towers reaching the dark clouds of... darkness... and whatsoever.
But, since tonumber will either return a number or nil, won't it then be unnecessary to add the other "not"? Since it will just require more computing powah... J:>
- As, oboioboi, turned off party settings. |
|
|
| Report Abuse |
|
|
|
| 22 Mar 2013 06:39 PM |
If you only include one not then it will return the OPPOSITE of the truth. It is essential that you invert the value enough so that it is equivalent to its original value.
ElectricBlaze • Programmer • Wiki Writer | http://wiki.roblox.com/index.php/User:ElectricBlaze |
|
|
| Report Abuse |
|
|
|
| 22 Mar 2013 06:42 PM |
| So this detects if its only a number? |
|
|
| Report Abuse |
|
|
|
| 22 Mar 2013 06:43 PM |
It detects if it CAN be a number, so either 5 or "5" both qualify.
if not not tonumber(valuehere) then
And again, make sure you include both nots.
ElectricBlaze • Programmer • Wiki Writer | http://wiki.roblox.com/index.php/User:ElectricBlaze |
|
|
| Report Abuse |
|
|
As8D
|
  |
| Joined: 24 Dec 2009 |
| Total Posts: 2907 |
|
|
| 22 Mar 2013 06:45 PM |
Waitwhat.
We do agree that: 2 is a number. Æ is not a number. Right?
Since tonumber("2") will still return a value that's not considered false (ok, nil).
Ok, so the extra wait will simply turn nil to false, and all other value to true. To explain it in short terms.
I don't see why it should be the opposite though.
- As, 00:45 will give us a time. But if that time is not the GMT, then we need some functions. |
|
|
| Report Abuse |
|
|
|
| 22 Mar 2013 06:46 PM |
| So after I put not not and stuff do I put ~= nil? |
|
|
| Report Abuse |
|
|
|
| 22 Mar 2013 06:48 PM |
| Me head spins from the randomness. |
|
|
| Report Abuse |
|
|
As8D
|
  |
| Joined: 24 Dec 2009 |
| Total Posts: 2907 |
|
|
| 22 Mar 2013 06:49 PM |
~= nil is... self-explanatory.
All data types in Roblox can be converted to either true or false (if we take the big... frog-glasses or whatever you use on).
nil --> false false --> false true --> true 2 --> true "a" --> true "" --> true {} --> true ect.
- As, I will not bow for the frog queen. Not if you hunted me down. |
|
|
| Report Abuse |
|
|
|
| 22 Mar 2013 06:51 PM |
| It seems that I must use tables. My head hurts to much from trying to understands tonumber() |
|
|
| Report Abuse |
|
|
As8D
|
  |
| Joined: 24 Dec 2009 |
| Total Posts: 2907 |
|
|
| 22 Mar 2013 07:00 PM |
I won't allow you to do such. It will become more inefficient if you use tables. More computing powah.
I shall fix ur script vari soon, so don't leave!
- As, leave and my toe will eat you. |
|
|
| Report Abuse |
|
|
As8D
|
  |
| Joined: 24 Dec 2009 |
| Total Posts: 2907 |
|
|
| 22 Mar 2013 07:04 PM |
-----------------------------------------------------------------------------------------------
function Calculate() local t = script.Parent local c = t.Num1.Text local g = t.Num2.Text local cal = t.Answer if not (tonumber(c) and tonumber(g)) then cal.Text = "Invalid Equation" return end local add = c + g local sub = c - g local mul = c * g local div = c / g local var = t.Variable.Text if var == "+" then cal.Text = "Answer is "..tostring(add) elseif var == "-" then cal.Text = "Answer is "..tostring(sub) elseif var == "*" then cal.Text = "Answer is"..tostring(mul) elseif var == "x" then cal.Text = "Answer is "..tostring(mul) elseif var == "/" then cal.Text = "Answer is "..tostring(div) else cal.Text = "Invalid Equation" end end
local e = script.Parent e.Num1.Changed:connect(Calculate) e.Num2.Changed:connect(Calculate) e.Variable.Changed:connect(Calculate) e.Answer.Changed:connect(Calculate)
-----------------------------------------------------------------------------------------------
- As, I am me. But I must say, I want to ride on a cloud like blaze... rod? |
|
|
| Report Abuse |
|
|
|
| 22 Mar 2013 07:04 PM |
| Dear god please just use this http://www.roblox.com/Calculator-item?id=87945335 |
|
|
| Report Abuse |
|
|
|
| 22 Mar 2013 07:07 PM |
| Nu, I'm maeking mai own calculator. :3 |
|
|
| Report Abuse |
|
|
|
| 22 Mar 2013 07:10 PM |
| I must nao analyze As8D's script randomly. And learn return. |
|
|
| Report Abuse |
|
|
As8D
|
  |
| Joined: 24 Dec 2009 |
| Total Posts: 2907 |
|
|
| 22 Mar 2013 07:10 PM |
@chaotic; Can we type lua code into it? I see math library functions >_>
@everyone;
Instead of making calculators, help me make an API for chemistry and physics :O Dat'z mawch moar intereztin!k
Wee vil ohm rublakz phawzikz wid ur neew AiPiiAiii!!!!
- As, whatz ai jawzt zait. |
|
|
| Report Abuse |
|
|
As8D
|
  |
| Joined: 24 Dec 2009 |
| Total Posts: 2907 |
|
|
| 22 Mar 2013 07:16 PM |
http://wiki.roblox.com/index.php/Return#Using_Return http://wiki.roblox.com/index.php/Operators http://wiki.roblox.com/index.php/Number http://wiki.roblox.com/index.php/Function_Dump/Core_Functions#tonumber
Just a few links for you to roar with. - As, we are bears. We are polar bears? No, I'd rather be a grizzly bear. I guess. |
|
|
| Report Abuse |
|
|
|
| 22 Mar 2013 07:46 PM |
@As8D
Yes, but you're very limited. It only allows like, print and stoof. |
|
|
| Report Abuse |
|
|
|
| 22 Mar 2013 07:50 PM |
| I'm only 12, I dunno wut an API is. |
|
|
| Report Abuse |
|
|