|
| 06 Sep 2012 01:08 PM |
| If I have a super-long code with no wait() in one script, and another script with one line of code, do they both start and finish at the same time? |
|
|
| Report Abuse |
|
|
|
| 06 Sep 2012 01:09 PM |
Let me rephrase that,
one script is super long, another is super short, both scripts have no wait() in them. |
|
|
| Report Abuse |
|
|
|
| 06 Sep 2012 01:19 PM |
They won't finish at the same time. The long one will take a small amount of time. Around 2000 lines (like Anaminus' Hyperspace Cruiser) will take around 3-5 seconds. Small one seems instant. |
|
|
| Report Abuse |
|
|
|
| 06 Sep 2012 02:12 PM |
Scripts can't run instantaneously [not short and especially not long].
If they did there would be no such thing as encryption and there would be no such thing as electronic banking, waiting for your computer to start up, network latency, low framerates, expensive processors, etc. |
|
|
| Report Abuse |
|
|
|
| 06 Sep 2012 02:19 PM |
@Blue; But isn't some of that constrained to hardware restrictions?
☜▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬☜☆☞▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬☞ - Candymaniac, a highly reactive substance. |
|
|
| Report Abuse |
|
|
|
| 06 Sep 2012 02:23 PM |
| That's exactly my point. If you're making scripts run in constant-speed no matter what you are violating fundamental parts of how the universe works like Light Speed. |
|
|
| Report Abuse |
|
|
Priminal
|
  |
| Joined: 02 Sep 2012 |
| Total Posts: 18 |
|
|
| 06 Sep 2012 02:29 PM |
| This would depend on what type of computer, RAM, how fast the servers are and other variables to part with. |
|
|
| Report Abuse |
|
|
mew903
|
  |
| Joined: 03 Aug 2008 |
| Total Posts: 22071 |
|
|
| 06 Sep 2012 02:50 PM |
| I guess by the amount of work the script has to do. |
|
|
| Report Abuse |
|
|
RA2lover
|
  |
| Joined: 09 Nov 2008 |
| Total Posts: 1254 |
|
|
| 06 Sep 2012 04:01 PM |
all answers are wrong.
the first script to complete is the one who got first on the thread execution queue. this means the short script can finish running AFTER the long one. |
|
|
| Report Abuse |
|
|
TaslemGuy
|
  |
| Joined: 10 Jun 2009 |
| Total Posts: 12174 |
|
|
| 06 Sep 2012 04:04 PM |
@RA
They're executed in parallel.
I'm not exactly sure how Studio parallelizes them, but your statement is fundamentally wrong. |
|
|
| Report Abuse |
|
|
MrHistory
|
  |
| Joined: 30 Aug 2010 |
| Total Posts: 5291 |
|
|
| 06 Sep 2012 04:05 PM |
| If scripts ran instantaneously, we would be in Star Wars by now |
|
|
| Report Abuse |
|
|
|
| 06 Sep 2012 04:05 PM |
@Mr; But they don't because of hardware constraints.
☜▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬☞ |
|
|
| Report Abuse |
|
|
Seranok
|
  |
| Joined: 12 Dec 2009 |
| Total Posts: 11083 |
|
|
| 06 Sep 2012 04:05 PM |
> They're executed in parallel.
According to stravant, that statement is false, since Lua doesn't really have true multi-threading. If one script has a wait() statement then most likely the other script will start (and finish) running before the original script resumes. |
|
|
| Report Abuse |
|
|
TaslemGuy
|
  |
| Joined: 10 Jun 2009 |
| Total Posts: 12174 |
|
|
| 06 Sep 2012 04:06 PM |
@Seranok
Lua doesn't implement the calling. The Roblox server does, which I assume is built in C, which DOES has true multithreading.
Even with Lua's light threads, you can still do "multithreading" in Lua to execute in parallel, you just get 0 speed gain. |
|
|
| Report Abuse |
|
|
Seranok
|
  |
| Joined: 12 Dec 2009 |
| Total Posts: 11083 |
|
|
| 06 Sep 2012 04:08 PM |
| My experience disagrees with that. |
|
|
| Report Abuse |
|
|
RA2lover
|
  |
| Joined: 09 Nov 2008 |
| Total Posts: 1254 |
|
|
| 06 Sep 2012 04:18 PM |
Roblox only runs ONE script at a time.
wait() halts that script's execution and tells roblox it can execute another one. |
|
|
| Report Abuse |
|
|