generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: PCall is cool

Previous Thread :: Next Thread 
vat21s is not online. 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 is not online. 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 is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
13 Dec 2016 02:54 AM
so is typeof
Report Abuse
vat21s is not online. vat21s
Joined: 07 Jun 2010
Total Posts: 2508
13 Dec 2016 03:40 AM
typeof Sounds alot less hacky :) thanks
Report Abuse
MK_0 is online. 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 is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
13 Dec 2016 03:53 AM
he said less hacky
Report Abuse
HlCOM is not online. 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 is online. 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 is online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image