|
| 22 Jan 2013 01:42 PM |
Can I say something like:
X = true
while true do
if X == true then
X = false
elseif X == false then
X = true
end
end |
|
|
| Report Abuse |
|
|
spookyBen
|
  |
| Joined: 13 Dec 2009 |
| Total Posts: 6581 |
|
|
| 22 Jan 2013 01:44 PM |
| This is something I've been wondering for a while. I'm not sure. |
|
|
| Report Abuse |
|
|
|
| 22 Jan 2013 01:45 PM |
X = true
while true do X = not X wait(1) print(x) end |
|
|
| Report Abuse |
|
|
|
| 22 Jan 2013 01:47 PM |
So you can?
And I can see the "X = not X" being convenient. |
|
|
| Report Abuse |
|
|
Th30racle
|
  |
| Joined: 03 Nov 2012 |
| Total Posts: 214 |
|
| |
|
|
| 22 Jan 2013 02:32 PM |
| Yeah, using not can save you quite a bit of time. |
|
|
| Report Abuse |
|
|
|
| 22 Jan 2013 02:45 PM |
@op
X = true
while true do
if X then
-- The same as " if X == true then ", more efficient to do " if X then ", also, it can work as if it is there or i.e., ( if game.Workspace.Brick ~= nil then ) can work as ( if game.Workspace.Brick )
X = false
elseif not X then -- Same as " if X == false then "
X = true
end
wait() -- Always add a wait when doing "while true do" because it can and most likely will crash your game if you don't.
end
~ṡсɾïρτïṉģ hεlρεɾṡ ۩ lυαlεαɾṉεɾṡ ④ øƒвќṃṿј~ ღ ▂▃▅▆█ρεώḋïερïε☄сυτïερïε█▆▅▃▂ღ 【▬】 |
|
|
| Report Abuse |
|
|
|
| 22 Jan 2013 02:46 PM |
Additionally, since it may not have sunk in, you can do this:
local b = 5 local a = b == 5
Any intermediate in any operation can be set to a variable.
(The exception being where something returns multiple values, you can't set one variable to multiple values explicitly, [but you could wrap them up in a table or something]) |
|
|
| Report Abuse |
|
|