Thread: Include files
View Single Post
09-12-18, 01:44 AM   #1
doofus
A Chromatic Dragonspawn
Join Date: Feb 2018
Posts: 158
Include files

Hello guys

I have a rather large addon which is in a single .lua file, and it has about 15,000 lines and it is hard to navigate. Because lua variables are global I precede them with "local" so they can only be seen in my own file and avoid namespace issues with other addons. Because everyting is in one .lua file I do not have to worry about declarations of functions and variables and only make sure I declare them in the right order.

I want to split this large .lua file into smaller files just for ease of editing purposes.

In C/C++ I would simply do, #include "file1.c". With the "#include" the C compiler simply merges source files together as one might do by hand. file1.c would not compile on its own of course, it is just a convenient way to split a large source code file into chunks without worrying too much about externs and linkage.

That is in the C world. Is there a way to do the same in wow's lua?

thanks
  Reply With Quote