Apologies if I'm not doing this right, I registered my account mere minutes prior to writing this post.
I use 30log for classes in my game, which represent objects in the world.
In my case, all objects are loaded from their own files in a folder called "entities" and each file is provided a table called "ENT".
Additionally, they (should) automatically inherit methods from their desired entities, of whose name is defined in "ENT.__base"
Right now, what I'm trying to do is create a class for each file prior to actually loading each file and passing that class as "ENT", but it doesn't seem to work
What approach should I use for this problem?
Trying to load classes from files with inheritance
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
-
- Prole
- Posts: 3
- Joined: Mon Sep 23, 2024 2:11 pm
Re: Trying to load classes from files with inheritance
Not sure without seeing the code. But indeed you can load (require) mutiple files and create and merge objects from them.
My boat driving game demo: https://dusoft.itch.io/captain-bradley- ... itius-demo
-
- Prole
- Posts: 3
- Joined: Mon Sep 23, 2024 2:11 pm
Re: Trying to load classes from files with inheritance
That was a good enough reply to get me to change the way I load entities.
The approach I use now is simply requiring a function/an object that can be called, to be returned, that itself returns a table.
With the class system, I require the base and extend it.
Thank you
The approach I use now is simply requiring a function/an object that can be called, to be returned, that itself returns a table.
With the class system, I require the base and extend it.
Thank you
Re: Trying to load classes from files with inheritance
Well, good, showing the way is often better than fixing issues for you :-)
My boat driving game demo: https://dusoft.itch.io/captain-bradley- ... itius-demo
-
- Prole
- Posts: 3
- Joined: Mon Sep 23, 2024 2:11 pm
Re: Trying to load classes from files with inheritance
After all, I was asking for an approach on solving this.
Re: Trying to load classes from files with inheritance
Glad you solved it.
My boat driving game demo: https://dusoft.itch.io/captain-bradley- ... itius-demo
Who is online
Users browsing this forum: Bing [Bot] and 13 guests