[DiscordArchive] hmm, but in your examples there the classname is nowhere as string, would that matter?
[DiscordArchive] hmm, but in your examples there the classname is nowhere as string, would that matter?
Archived author: Grandold • Posted: 2022-05-16T17:33:16.649000+00:00
Original source
hmm not sure if I'm getting it or if we are actually talking about the same thing
Archived author: Foe • Posted: 2022-05-16T17:33:46.535000+00:00
Original source
That's using a string as a reference to a function in the global namespace and calling it as a function
Archived author: Grandold • Posted: 2022-05-16T17:39:00.613000+00:00
Original source
hmm, do you think that my last example of classes A and B should actually call the get() method of classes A and B?
Archived author: Foe • Posted: 2022-05-16T17:39:28.795000+00:00
Original source
Not without you doing something like _G["A"]():get()
Archived author: Foe • Posted: 2022-05-16T17:40:07.482000+00:00
Original source
```Lua
local classes = {
'A',
'B'
}
for k, v in pairs(classes) do
_G[v]:get()
end```
Archived author: Grandold • Posted: 2022-05-16T17:40:14.382000+00:00
Original source
do you mean I would specifically need to use the global scope to that? cos that is what I'm trying to avoid
Archived author: Foe • Posted: 2022-05-16T17:40:27.625000+00:00
Original source
Yes, you can't call a local value in a different script
Archived author: Grandold • Posted: 2022-05-16T17:40:48.513000+00:00
Original source
well even if classes wasnt local
Archived author: Foe • Posted: 2022-05-16T17:41:09.679000+00:00
Original source
If the class isn't local, then it's in the global namespace, unless it's in the same script
Archived author: Grandold • Posted: 2022-05-16T17:41:23.886000+00:00
Original source
then it would just be _G['classes'][v]:get() right?