Davidii
|
  |
| Joined: 17 Jul 2008 |
| Total Posts: 1282 |
|
|
| 10 Sep 2012 02:24 PM |
...this is really useful. This allows for some backwards-up-side-down OOP, doesn't it? It makes me very happy.
http://wiki.roblox.com/index.php/BindableFunction
I've already done some basic things by defining tables inside of scripts and simply using these to transfer the table over to another for arithmetic, for instance Player 1 hits Player 2, etc. Good for, I dunno, a ton of stuff.
Is this cOLD mOLD on a sLATE pLATE? |
|
|
| Report Abuse |
|
|
Seranok
|
  |
| Joined: 12 Dec 2009 |
| Total Posts: 11083 |
|
|
| 10 Sep 2012 02:26 PM |
Hey Davidii I just wanted to say that your anti-teamkill sword script helped me start to script. :)
And also yes we have known about that instance for a while but I have never used it personally. |
|
|
| Report Abuse |
|
|
| |
|
Davidii
|
  |
| Joined: 17 Jul 2008 |
| Total Posts: 1282 |
|
|
| 10 Sep 2012 02:28 PM |
| @Seranok, that was probably Daviidi, of no relation to me. Freakishly similar names, though. Anyways, uh, yeah, sorry it's late but I just think of all the possibilities. And I'm excited. |
|
|
| Report Abuse |
|
|
eJorge
|
  |
| Joined: 09 Jun 2011 |
| Total Posts: 5966 |
|
|
| 10 Sep 2012 02:28 PM |
| Does it work to send functions from a script to a local script? I've been experimenting with it, but I haven't got it to work properly. |
|
|
| Report Abuse |
|
|
Davidii
|
  |
| Joined: 17 Jul 2008 |
| Total Posts: 1282 |
|
|
| 10 Sep 2012 02:30 PM |
| LocalScripts just cause explosions everywhere. Avoid them if unless necessary... they... they can't access _G... :'( |
|
|
| Report Abuse |
|
|
|
| 10 Sep 2012 02:33 PM |
David, you're doin' eet wrung!
LocalScripts all da way! (unless it's not possible to do something with a LS, or it would be liek inefficient und stoof). |
|
|
| Report Abuse |
|
|
Davidii
|
  |
| Joined: 17 Jul 2008 |
| Total Posts: 1282 |
|
|
| 10 Sep 2012 02:34 PM |
| Having things server side reduces player lag and increases response time. Myrco, YOU'RE doing it wrong. |
|
|
| Report Abuse |
|
|
|
| 10 Sep 2012 02:36 PM |
I think you don't understand me ._.
Let's talk about this at a fireplace with a big nice cup of tea =3! |
|
|
| Report Abuse |
|
|
Seranok
|
  |
| Joined: 12 Dec 2009 |
| Total Posts: 11083 |
|
|
| 10 Sep 2012 02:36 PM |
> Daviidi
NOOOOOOOOOOOOOO!! :'( |
|
|
| Report Abuse |
|
|
eJorge
|
  |
| Joined: 09 Jun 2011 |
| Total Posts: 5966 |
|
|
| 10 Sep 2012 02:37 PM |
| I hate it how I can't use _G for my tools, it makes things very difficult. |
|
|
| Report Abuse |
|
|
Davidii
|
  |
| Joined: 17 Jul 2008 |
| Total Posts: 1282 |
|
|
| 10 Sep 2012 02:37 PM |
| Indeed, perhaps this object fixes that? :/ |
|
|
| Report Abuse |
|
|
Seranok
|
  |
| Joined: 12 Dec 2009 |
| Total Posts: 11083 |
|
|
| 10 Sep 2012 02:37 PM |
> LocalScripts just cause explosions everywhere. Avoid them if unless necessary... they... they can't access _G... :'(
Actually LocalScripts can access _G. It's just that the client has a different _G table than the server. |
|
|
| Report Abuse |
|
|
|
| 10 Sep 2012 02:39 PM |
^yes!
Another swim ticket for you across the nordig fjords. |
|
|
| Report Abuse |
|
|
Davidii
|
  |
| Joined: 17 Jul 2008 |
| Total Posts: 1282 |
|
|
| 10 Sep 2012 02:40 PM |
| Whoaaa, so all I have to do to access _G from LocalScripts is to make an exact copy of my globals script and put it in a local script? Or... er... what? |
|
|
| Report Abuse |
|
|
|
| 10 Sep 2012 02:41 PM |
| Just think of it that liek the normal scripts and LocalScripts both have their own _G and LSes can only acces the LSes' _G and same goes for the Scripts - only their _G can be acced by them. |
|
|
| Report Abuse |
|
|
stravant
|
  |
 |
| Joined: 22 Oct 2007 |
| Total Posts: 2893 |
|
|
| 10 Sep 2012 05:52 PM |
"Whoaaa, so all I have to do to access _G from LocalScripts is to make an exact copy of my globals script and put it in a local script? Or... er... what?"
Well, that will work so long as there's no shared data that needs to be shared. They'll still be totally separate. It's just that every client has it's own _G (what would be the case otherwise? Lua replicates every single local variable?, which it would need to do to make that possible. It wouldn't even be feasible to make it do so)
Also, for BindableEvents / Methods. Be wary of passing large data structures through them. Even if both definition and invocation are on the same client, any tables that you pass it will still be deep-copied (AND there's a bug that if you pass a table with both keys and indices ONLY the indices will be copied, it will silently fail to copy the keys).
The upside is that that makes it so in the future they will work over the network exactly the same as locally. |
|
|
| Report Abuse |
|
|
|
| 10 Sep 2012 07:09 PM |
| I didn't know that Roblox was using Bindable objects for exposing APIs until yesterday... |
|
|
| Report Abuse |
|
|
|
| 10 Sep 2012 07:10 PM |
| I've still never even seen how Bindable objects work =/ I really should wiki them. |
|
|
| Report Abuse |
|
|
sirsavary
|
  |
| Joined: 27 May 2008 |
| Total Posts: 1222 |
|
|
| 10 Sep 2012 07:19 PM |
| Bindable objects are pretty great. I'm a huge OOP person, and being able to have functions that I can access from anywhere are great. Allows me to add methods for special attacks on monsters that can be called anytime I want. |
|
|
| Report Abuse |
|
|
mew903
|
  |
| Joined: 03 Aug 2008 |
| Total Posts: 22071 |
|
| |
|
booing
|
  |
| Joined: 04 May 2009 |
| Total Posts: 6594 |
|
|
| 12 Sep 2012 07:25 AM |
| they're coming over for a cup of tea |
|
|
| Report Abuse |
|
|
SN0X
|
  |
| Joined: 24 Oct 2011 |
| Total Posts: 7277 |
|
|
| 12 Sep 2012 07:54 AM |
"LocalScripts just cause explosions everywhere."
Uhhh...I'm not sure if this is illiteral, but well...
yeah. rite.
--
I think personally that you should avoid doing complex stuff with local scripts, unless you're purposely trying to lagg them out, or something...but for simple things, save the server some work and use client's computers to run scripts.
For example,
In a LocalScript:
GUI = script.Parent GUI.Text = "Welcome" for i = 1, 10 do GUI.Transparency = GUI.Transparency = 0.1 wait(.1) end GUI.Text = "To the epik duk's lay0r."
In a server-sided script:
GUI = script.Parent for _, v in pairs(Game:GetChildren()) do for si, sv in pairs(v:GetChildren()) do ---some h44xy math thing that does a whole lot of h44x and math and ouchy burn-out short-circuiting hell to the CPU lawl end end
--
Also, throttle scripts which aren't of a very high priority.
For example, a cleanup script which deletes useless hats in the workspace...or a leaderboard that has to check all player's scores, sort them, then create GUIs. |
|
|
| Report Abuse |
|
|
| |
|
|
| 13 Sep 2012 10:53 AM |
^ Was it Ford Prefect who said how humans repeated the obivous many times? |
|
|
| Report Abuse |
|
|