|
| 18 Nov 2014 09:02 AM |
Could I access a method as a property, like this:
if part.IsA then
--ThatChristianGuy |
|
|
| Report Abuse |
|
|
|
| 18 Nov 2014 10:49 AM |
Totally.
:IsA() is actually "syntactic sugar".
If you wanted to do it the longer way, or more correct way (I guess?), just use
if game.IsA(game.Workspace.Part, "BasePart") then print("game.Workspace.Part is a BasePart!") end |
|
|
| Report Abuse |
|
|
|
| 18 Nov 2014 10:52 AM |
To be more specific, when you use the colon, it automatically gives the first argument as what precedes the colon.
When you use a dot, you need to supply the "self" argument, which is the first one.
so game.IsA is the "IsA" function.
local IsA = game.IsA
and to do Part:IsA("Part"), do
IsA(Part, "BasePart")
http://blog.roblox.com/2012/02/an-optimization-for-lua-scripts-2/ |
|
|
| Report Abuse |
|
|
|
| 18 Nov 2014 11:35 AM |
Yeah, Ik about the methods & such, I was just wondering if they were nonaccessible that way or something. Thanks!
--ThatChristianGuy |
|
|
| Report Abuse |
|
|