|
| 01 Feb 2015 07:13 AM |
The only current way to make "custom properties" (Well kinda) is to add values such as NumberValue, StringValue, etc. (See http://wiki.roblox.com/index.php?title=Class_reference (scroll down to Values))
What if we had a FunctionValue?
Yes, a FunctionValue stores exactly what you think it does, a Function (See http://wiki.roblox.com/index.php?title=Functions)! This can be used for creating methods.
Like ObjectValues (No documentation on wiki for ObjectValue), a FunctionValue can only be set through commandbar/a script. Here's an example of how it works:
function func(self, ...) print(...) end
local FuncValue = Instance.new("FunctionValue", workspace.Part)
FuncValue.Value = func
FuncValue:Value("Hello")
--> Hello
So what exactly was self? Well without giving you a scripting lesson on methods, it's basically the table the function is in (For more information see http://wiki.roblox.com/index.php?title=Methods). It would be the FunctionValue instance itself. So assuming you wanted to change the parent's transparencey, here's another example:
function func(self) self.Parent.Transparency = 1 end
local FuncValue = Instance.new("FunctionValue", workspace.Part)
FuncValue.Value = func FuncValue.Name = "Invisible"
FuncValue:Value()
--Or from any other script:
workspace.Part.Invisible:Value()
Granted having to go :Value() instead of :Invisible() is a little annoying, but then again, so is the .Value property of any of these Values.
With all the other *Value objects, it only makes sense to have this. Without giving us custom instances, this may be the only real way to do this any time in the near future. (http://www.roblox.com/Forum/ShowPost.aspx?PostID=155068805)
Thank you for your time reading this, let's show some support!
Support Ratio; 1:0 |
|
|
| Report Abuse |
|
|
|
| 01 Feb 2015 07:16 AM |
Support
Also add UDim2 values, because having Ray values but not UDim2 values seems really stupid |
|
|
| Report Abuse |
|
|
|
| 01 Feb 2015 07:18 AM |
Definite Support! :D it's like ur taking all the ideas out of my head XD cos all of the Suggestions u Posted (all that I seen) are the ones I've been thinking on sometimes |
|
|
| Report Abuse |
|
|
|
| 01 Feb 2015 07:18 AM |
| Support, even though they can be ran through _G, or through Remote/BindableEvents. |
|
|
| Report Abuse |
|
|
| |
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 01 Feb 2015 08:34 AM |
| No support; BindableFunctions, BindableEvents, ModuleScripts |
|
|
| Report Abuse |
|
|
maxomega3
|
  |
| Joined: 11 Jun 2010 |
| Total Posts: 10668 |
|
|
| 01 Feb 2015 08:35 AM |
That's kinda cool Support!
Only I don't see why you can't just use a BindableFunction |
|
|
| Report Abuse |
|
|
|
| 01 Feb 2015 08:38 AM |
Support Ratio; 5:1
The reason why not the use ModuleScripts, BindableEvents, etc. is simple.
newbies would have an easier time with FunctionValue. |
|
|
| Report Abuse |
|
|
| |
|
| |
|
SamDomino
|
  |
| Joined: 12 Jul 2012 |
| Total Posts: 41 |
|
|
| 02 Feb 2015 04:11 PM |
Support I guess.
Effort and Courage is useless without Purpose and Direction |
|
|
| Report Abuse |
|
|
| |
|
| |
|
Roblok1
|
  |
| Joined: 27 Jul 2011 |
| Total Posts: 2019 |
|
|
| 05 Feb 2015 01:25 PM |
| Hey, this could actually work. I could probably make custom open and close functions just by calling the function value. Nice suggestion. |
|
|
| Report Abuse |
|
|
| |
|
|
| 05 Feb 2015 01:51 PM |
| Support. Even though this is far too complicated for me to comprehend. xD |
|
|
| Report Abuse |
|
|
|
| 05 Feb 2015 01:54 PM |
| How may this differ from any else value kind? |
|
|
| Report Abuse |
|
|
|
| 05 Feb 2015 01:56 PM |
this thread is censored in the re:
gg, whitelist fail
anyways, it would be nice being able to share functions among scripts |
|
|
| Report Abuse |
|
|
|
| 05 Feb 2015 01:59 PM |
| I mean how could it be useful. |
|
|
| Report Abuse |
|
|
|
| 05 Feb 2015 03:48 PM |
Support Ratio; 9:1
Forum, How I love explaining my ideas to you :D
Basically, the same way a NumberValue is important. Except a FunctionValue could allow making methods for objects (well, sorta)
If you think a NumberValue or StringValue (etc.) is important, I see no reason why you wouldn't support this. |
|
|
| Report Abuse |
|
|
|
| 05 Feb 2015 04:07 PM |
| I must look more into the method thing, until I decide. |
|
|
| Report Abuse |
|
|