|
| 15 May 2013 05:04 PM |
| How would you do this? I can't do thingy:IsA("Instance") because you can only do that with instances. |
|
|
| Report Abuse |
|
|
|
| 15 May 2013 05:07 PM |
What? If your trying to figure out if a variable hold a instance then you could do:
local IsInstance = function(Thing) if pcall(function() print(Thing.Name) end) then return true else return nil end end
local Bob = Workspace.Part local Joe = "kdsa" print(IsInstance(Bob)) print(IsInstance(Joe))
>True >False |
|
|
| Report Abuse |
|
|
| |
|
|
| 15 May 2013 05:09 PM |
What else might it be?
type(obj)
would be
"userdata"
Though this will also be true for CFrame, Vector3, UDim2. |
|
|
| Report Abuse |
|
|
|
| 15 May 2013 05:10 PM |
| newproxy returns a userdata also. |
|
|
| Report Abuse |
|
|
|
| 15 May 2013 05:15 PM |
Garbage in, garbage out; if he's planning on trying to be confusing then that's what you'd expect.
The function you provided similarly fails for
{Name = {12,87}}
and also annoyingly prints to output. |
|
|
| Report Abuse |
|
|
|
| 15 May 2013 05:18 PM |
function instance(inst) local a = pcall( function() local b = game.IsA(inst,"Instance"); end ); if not a then return false; end return game:IsA(inst,"Instance"); end
This ought to have no holes. |
|
|
| Report Abuse |
|
|