sonihi
|
  |
| Joined: 27 Jun 2009 |
| Total Posts: 3655 |
|
|
| 10 Sep 2016 03:50 PM |
| Is there anyway I can get the metatable of for example Instance.new("Part") even though the metatable is locked? |
|
|
| Report Abuse |
|
|
|
| 10 Sep 2016 03:52 PM |
nope not unless you go into the roblox lua setup C files also you dont want to edit it, i am pretty sure that if you newindex it will be locked |
|
|
| Report Abuse |
|
|
sonihi
|
  |
| Joined: 27 Jun 2009 |
| Total Posts: 3655 |
|
|
| 10 Sep 2016 03:53 PM |
| aww man looks like i cant add my own methods to color3s |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
| |
|
ParaText
|
  |
| Joined: 15 Aug 2016 |
| Total Posts: 799 |
|
| |
|
sonihi
|
  |
| Joined: 27 Jun 2009 |
| Total Posts: 3655 |
|
|
| 10 Sep 2016 03:57 PM |
| Yeah I did that but it'd be nicer if I could add LerpHSV into the actuall metatable |
|
|
| Report Abuse |
|
|
|
| 10 Sep 2016 03:57 PM |
you can make your own
myColor3 = { __index = function(t,k) if k=="R" then return t.r end if k=="G" then return t.g end if k=="B" then return t.b end return nil end; } function myColor3.new(r,g,b) return setmetatable({r=(r or 0),g=(g or 0),b=(b or 0)},myColor3) end function myColor3:__tostring() return table.concat({self.r,self.g,self.b},",") end --etc
print(myColor3.new(1,1,1)) |
|
|
| Report Abuse |
|
|
Afro_Sub
|
  |
| Joined: 16 Jun 2013 |
| Total Posts: 1114 |
|
| |
|
|
| 10 Sep 2016 03:58 PM |
or you can get all of the functions of the regular color3
local b = Color3 Color3 = {} for k,v in pairs(b) do Color3[k] = v end
--and now you unlocked Color3 for editing |
|
|
| Report Abuse |
|
|
sonihi
|
  |
| Joined: 27 Jun 2009 |
| Total Posts: 3655 |
|
|
| 10 Sep 2016 03:58 PM |
{r=(r or 0)
what is this
"r=(r or 0)"
wouldn't that be true or false? |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 10 Sep 2016 03:59 PM |
Color3:lerp(Color3.fromHSV(h,s,v),alpha)
|
|
|
| Report Abuse |
|
|
|
| 10 Sep 2016 04:00 PM |
or picks the first value that is not nil or false
and picks the last value if all is not nil or false, returns false if not
so
2 and 0 >0 nil and 0 >false
2 or 0 >2 nil or 0 >0 |
|
|
| Report Abuse |
|
|
Kodran
|
  |
| Joined: 15 Aug 2013 |
| Total Posts: 5330 |
|
|
| 10 Sep 2016 04:00 PM |
and/or operators in lua work like this:
a and b if a then return b, else return a
a or b if a then return a, else return b
|
|
|
| Report Abuse |
|
|
sonihi
|
  |
| Joined: 27 Jun 2009 |
| Total Posts: 3655 |
|
|
| 10 Sep 2016 04:00 PM |
"or you can get all of the functions of the regular color3
local b = Color3 Color3 = {} for k,v in pairs(b) do Color3[k] = v end
--and now you unlocked Color3 for editing "
that doesn't work properly, I inserted my own method there and it doesn't work. Also "Color3[k] = v" just throws an error, you need to actually copy the table and set Color3 to it. |
|
|
| Report Abuse |
|
|
|
| 10 Sep 2016 04:01 PM |
dude it does not error
local b = Color3 Color3 = {} for k,v in pairs(b) do Color3[k] = v end
function Color3.wow() print("WOW") end
Color3.wow() |
|
|
| Report Abuse |
|
|
sonihi
|
  |
| Joined: 27 Jun 2009 |
| Total Posts: 3655 |
|
|
| 10 Sep 2016 04:02 PM |
@TimeTicks
Color3:lerp(Color3.fromHSV(h,s,v),alpha)
No the actual function lerps through HSV color space and not through RGB color space like the roblox function does. |
|
|
| Report Abuse |
|
|
|
| 10 Sep 2016 04:02 PM |
| it makes a new table and fills it up with all of the indexed items of the backup color3 |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 10 Sep 2016 04:03 PM |
Well you said you wanted LerpHSV, is that not what you want now?
|
|
|
| Report Abuse |
|
|
|
| 10 Sep 2016 04:04 PM |
| Color3.fromHSV(h,s,v):lerp(Color3.fromHSV(h,s,v),alpha) |
|
|
| Report Abuse |
|
|
sonihi
|
  |
| Joined: 27 Jun 2009 |
| Total Posts: 3655 |
|
|
| 10 Sep 2016 04:05 PM |
| No I made my own custom function that doesn't work like the roblox Color3:lerp(). Look up HSV interpolation and compare it to RGB interpolation |
|
|
| Report Abuse |
|
|
|
| 10 Sep 2016 04:05 PM |
then literally just do this and add your custom function
local b = Color3 Color3 = {} for k,v in pairs(b) do Color3[k] = v end
function Color3.wow() print("WOW") end
Color3.wow()
how does this possibly error |
|
|
| Report Abuse |
|
|
sonihi
|
  |
| Joined: 27 Jun 2009 |
| Total Posts: 3655 |
|
|
| 10 Sep 2016 04:07 PM |
But it is still not a method of the Color3. It is just a function in the Color3 table which does not help at all. Cause it doesn't work like a method on something like Color3.new(1,0,1):LerpHSV(Color3.new(0,1,0),alpha) |
|
|
| Report Abuse |
|
|
|
| 10 Sep 2016 04:08 PM |
it would work if you use your head
it acts exactly like the old Color3 except you can edit it -.- |
|
|
| Report Abuse |
|
|
|
| 10 Sep 2016 04:09 PM |
and you can just make Color3.HSVLerp()
instead
and you can just edit Color3.new() |
|
|
| Report Abuse |
|
|
sonihi
|
  |
| Joined: 27 Jun 2009 |
| Total Posts: 3655 |
|
|
| 10 Sep 2016 04:10 PM |
| ############################################################################################################################################ |
|
|
| Report Abuse |
|
|