Testing for "class"? #1388
Answered
by
Rouneq
Rouneq
asked this question in
General Questions
Testing for "class"?
#1388
|
Is there a way I can test for an annotated class? I 99% sure the answer is "no" and goes well beyond the capabilities of a Lua interpreter, but I thought I'd ask anyway. |
Answered by
Rouneq
Jul 25, 2022
Replies: 3 comments 5 replies
|
The best you can do is probably through metatables: --- This is your "Class"
local Target = {
active = false
}
local myTarget = {
name = "Target1"
}
setmetatable(myTarget, Target)
if getmetatable(myTarget) == Target then
print("myTarget is child of Target class")
end |
0 replies
|
I've considered that possibility. The problem is I don't own all the data. As I mentioned in another discussion, the game engine returns everything as |
5 replies
|
As suspected, the answer is "no". Or, at least "no" withing the confines of my working environment. Thanks for the feedback. |
0 replies
Answer selected by
Rouneq
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As suspected, the answer is "no". Or, at least "no" withing the confines of my working environment. Thanks for the feedback.