vat21s
|
  |
| Joined: 07 Jun 2010 |
| Total Posts: 2508 |
|
|
| 13 Dec 2016 02:20 AM |
function CheckType(value) local t=type(value) print(t) if t=="boolean" then t="Bool" elseif t=="number" and t~=math.floor(value) then t="Number" elseif t=="number" and t==math.floor(value) then t="Int" elseif pcall(function() local a=value:clone(); a=nil end)==true then t="Object" elseif pcall(function() local test=Instance.new("BrickColorValue") test.Value=value test=nil end)==true then t="BrickColor" elseif pcall(function() local test=Instance.new("Color3Value") test.Value=value test=nil end)==true then t="Color3" elseif pcall(function() local b=CFrame.new(1,1,1)-value b=nil end)==true then t="Vector3" elseif t=="string" then t="String" elseif pcall(function() local a=CFrame.new(1,1,1)*value a=nil end)==true and not(pcall(function() local b=CFrame.new(1,1,1)-value b=nil end)==true) then t="CFrame" end if t=="userdata" then print(tostring(value).." ERROR") else return t end end |
|
|
| Report Abuse |
|
|
HlCOM
|
  |
| Joined: 29 Mar 2009 |
| Total Posts: 3332 |
|
|
| 13 Dec 2016 02:53 AM |
| http://wiki.roblox.com/index.php?title=Global_namespace/Functions_specific_to_ROBLOX#typeof |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
| |
|
vat21s
|
  |
| Joined: 07 Jun 2010 |
| Total Posts: 2508 |
|
|
| 13 Dec 2016 03:40 AM |
| typeof Sounds alot less hacky :) thanks |
|
|
| Report Abuse |
|
|
MK_0
|
  |
| Joined: 28 Aug 2010 |
| Total Posts: 1651 |
|
|
| 13 Dec 2016 03:48 AM |
"hacky"
Dude it is a Roblox Built-in function...
I guess time() is too.
|
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
| |
|
HlCOM
|
  |
| Joined: 29 Mar 2009 |
| Total Posts: 3332 |
|
|
| 13 Dec 2016 03:54 AM |
hack·y ˈhakē/ adjectiveinformal 1. lacking originality; hackneyed. "we already know what those hacky punchlines are going to be" 2. (of a piece of computer code) providing a clumsy or inelegant solution to a particular problem. "I realize this is a hacky workaround but I don't have time to investigate a more solid fix" |
|
|
| Report Abuse |
|
|
MK_0
|
  |
| Joined: 28 Aug 2010 |
| Total Posts: 1651 |
|
|
| 13 Dec 2016 09:52 AM |
| #### Even still like... I can think of some "hacky" things to do with pcall or xpcall Not typeof |
|
|
| Report Abuse |
|
|
MK_0
|
  |
| Joined: 28 Aug 2010 |
| Total Posts: 1651 |
|
|
| 13 Dec 2016 09:52 AM |
Ok so I can't say your first 3 latters of your name so I'll just say @killme for now on.
|
|
|
| Report Abuse |
|
|