Lazulite
|
  |
| Joined: 09 Jun 2014 |
| Total Posts: 1217 |
|
|
| 20 Jun 2014 04:57 PM |
do function()
?
Is this like do-while but not a loop, running the function once?
I don't get what the "do" is for. |
|
|
| Report Abuse |
|
|
Locard
|
  |
| Joined: 13 Apr 2014 |
| Total Posts: 3516 |
|
|
| 20 Jun 2014 05:00 PM |
Erm...
never heard of it. But it'll probably error because of incorrect Syntax. |
|
|
| Report Abuse |
|
|
Lazulite
|
  |
| Joined: 09 Jun 2014 |
| Total Posts: 1217 |
|
|
| 20 Jun 2014 05:01 PM |
| No, it's correct syntax- nobody in SH has been able to explain though. |
|
|
| Report Abuse |
|
|
Locard
|
  |
| Joined: 13 Apr 2014 |
| Total Posts: 3516 |
|
|
| 20 Jun 2014 05:03 PM |
| I think it's just something that's completely unnecessary and could probably be written easier and more simpler. |
|
|
| Report Abuse |
|
|
Lazulite
|
  |
| Joined: 09 Jun 2014 |
| Total Posts: 1217 |
|
|
| 20 Jun 2014 05:10 PM |
"I think it's just something that's completely unnecessary and could probably be written easier and more simpler."
It was written by Devoi, an advanced scripter- so I put effort into trying to think of what he's writing. He forums in Scripters and writes more efficent code than almost any other clan's source I've seen.
So I'm gonna try to figure it out. |
|
|
| Report Abuse |
|
|
Locard
|
  |
| Joined: 13 Apr 2014 |
| Total Posts: 3516 |
|
|
| 20 Jun 2014 05:12 PM |
Notice I said 'I think'.
Not 'I know'.
I don't really rely on clan coders to look for efficiency. I mainly go to my GMod friends for help whenever I need it. |
|
|
| Report Abuse |
|
|
Lazulite
|
  |
| Joined: 09 Jun 2014 |
| Total Posts: 1217 |
|
|
| 20 Jun 2014 05:13 PM |
| What's GMod's version of Lua called? |
|
|
| Report Abuse |
|
|
Locard
|
  |
| Joined: 13 Apr 2014 |
| Total Posts: 3516 |
|
|
| 20 Jun 2014 05:18 PM |
| I think they just use standard Lua 5.3, but I'll go ask them. |
|
|
| Report Abuse |
|
|
|
| 20 Jun 2014 05:58 PM |
| That is just the name of the function...? |
|
|
| Report Abuse |
|
|
Lazulite
|
  |
| Joined: 09 Jun 2014 |
| Total Posts: 1217 |
|
|
| 20 Jun 2014 07:05 PM |
no it isn't
you define a function like function swag() |
|
|
| Report Abuse |
|
|
Vuva
|
  |
| Joined: 22 Jan 2010 |
| Total Posts: 1102 |
|
|
| 20 Jun 2014 07:20 PM |
| "function()" defines a function, it just dosen't assign it to any variable. "function swag()" defines the variabel swag as the function, same as "swag=function()" |
|
|
| Report Abuse |
|
|
Vuva
|
  |
| Joined: 22 Jan 2010 |
| Total Posts: 1102 |
|
|
| 20 Jun 2014 07:21 PM |
Oh an a do statement and a function both need an end, so it should at least be like this: "do function() end end" |
|
|
| Report Abuse |
|
|
zub74
|
  |
| Joined: 13 Sep 2008 |
| Total Posts: 489 |
|
|
| 20 Jun 2014 07:24 PM |
Perhaps do function() until stuff |
|
|
| Report Abuse |
|
|
|
| 20 Jun 2014 07:25 PM |
ROBLOX Filters say there is something wrong with this post, but I just went ahead and posted it on pastebin. It explains what 'do' is used.
http://pastebin.com/JBFGDz6S |
|
|
| Report Abuse |
|
|
Lazulite
|
  |
| Joined: 09 Jun 2014 |
| Total Posts: 1217 |
|
|
| 20 Jun 2014 07:26 PM |
What's the point of having a function then rather than just writing code?
|
|
|
| Report Abuse |
|
|
Vuva
|
  |
| Joined: 22 Jan 2010 |
| Total Posts: 1102 |
|
|
| 20 Jun 2014 07:26 PM |
OH AND I FORGOT SOMETHING This is the absolute minimum syntactically correct form:
"do (function() end)() end" |
|
|
| Report Abuse |
|
|
Lazulite
|
  |
| Joined: 09 Jun 2014 |
| Total Posts: 1217 |
|
| |
|