|
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 |
|
|
Support
Also add UDim2 values, because having Ray values but not UDim2 values seems really stupid |
|
KapKing47Join Date: 2012-09-09 Post Count: 5522 |
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 |
|
later_kJoin Date: 2016-02-25 Post Count: 2776 |
Support, even though they can be ran through _G, or through Remote/BindableEvents. |
|
|
eLunateJoin Date: 2014-07-29 Post Count: 13268 |
No support; BindableFunctions, BindableEvents, ModuleScripts |
|
maxomega3Join Date: 2010-06-11 Post Count: 10668 |
That's kinda cool
Support!
Only I don't see why you can't just use a BindableFunction |
|
|
Support Ratio; 5:1
The reason why not the use ModuleScripts, BindableEvents, etc. is simple.
newbies would have an easier time with FunctionValue. |
|
|
|
SamDominoJoin Date: 2012-07-12 Post Count: 41 |
Support I guess.
Effort and Courage is useless without Purpose and Direction |
|
|
|
Roblok1Join Date: 2011-07-27 Post Count: 2019 |
Hey, this could actually work. I could probably make custom open and close functions just by calling the function value. Nice suggestion. |
|
|
|
Support. Even though this is far too complicated for me to comprehend. xD |
|
|
How may this differ from any else value kind? |
|
XenonLiJoin Date: 2009-08-19 Post Count: 5013 |
this thread is censored in the re:
gg, whitelist fail
anyways, it would be nice being able to share functions among scripts |
|
|
I mean how could it be useful. |
|
|
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. |
|
|
I must look more into the method thing, until I decide. |
|