[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-16T18:15:46.486000+00:00
Original source
ye I see your point there, and how it just gotta be run through the _G thingie
Archived author: Foe • Posted: 2022-05-16T18:15:53.341000+00:00
Original source
yup
Archived author: Grandold • Posted: 2022-05-16T18:16:21.192000+00:00
Original source
done many autoloaders in php and ye its so different there I was just surprised it doesnt seem to work in lua
Archived author: Grandold • Posted: 2022-05-16T18:19:04.118000+00:00
Original source
But yeah, as it seems one just gotta somehow add the class to some variable in _G, I feel like the RegisterClass is bit more clear to read at least, currently just calling a function in my _G['MainClass'] to set the library class into a table inside the main object
![[Image: unknown.png?ex=690c3e05&is=690aec85&hm=8...afaad8b35&]](https://cdn.discordapp.com/attachments/448835144564867094/975824912721772614/unknown.png?ex=690c3e05&is=690aec85&hm=802d027ab5cc56b26e168cfa1d594210010d22845b4fc4d09c7cfc9afaad8b35&)
Archived author: Foe • Posted: 2022-05-16T18:19:49.302000+00:00
Original source
![[Image: unknown.png?ex=690c3e05&is=690aec85&hm=8...afaad8b35&]](https://cdn.discordapp.com/attachments/448835144564867094/975824912721772614/unknown.png?ex=690c3e05&is=690aec85&hm=802d027ab5cc56b26e168cfa1d594210010d22845b4fc4d09c7cfc9afaad8b35&)
Archived author: Foe • Posted: 2022-05-16T18:19:52.501000+00:00
Original source
This works too
Archived author: Grandold • Posted: 2022-05-16T18:20:18.081000+00:00
Original source
I think I have my MainClass not set as local, and I got a function :loadClass(class) there which I then use inside the library classes (which are local) to save the libraryclass inside a table in the MainClass
Archived author: Foe • Posted: 2022-05-16T18:20:33.037000+00:00
Original source
Many options, but yeah, I agree that using functions is clearer