You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tom O'Sullivan edited this page Nov 2, 2021
·
1 revision
Setting up a project that uses ClassLoader is easy. Firstly, acquire a copy of the appropriate library version for your environment from the Releases Page.
Now you'll want to create a new project, this may vary depending on your usage. For this example imagine we have a folder for our project called hello-world. We now need to create a program entry point file, in plain Lua you might call this main.lua, for Garry's Mod you'll want to create a Lua file with a unique name in the lua/autorun folder.
In our entry point file, we'll include ClassLoader and tell it how to load our classes. To do this, place your copy of class_loader.lua somewhere where you're able to reference from your code. Then edit your entry point file and add the following code:
localClassLoader=require("{class_loader.lua location}") --Garry's Mod uses "include" instead of "require"--Tell ClassLoader where our classes are and which one contains our Start() method.ClassLoader.Bootstrap("{classes folder location}", "your.package.name.StartClass")