Splitting up VGUI Code.

My cl_init seems to be getting a bit cluttered and large now, so I think I need to split it up into different files.

How do I split it up though? Do I just make a separate file for each item and add a “AddCSLuaFile( “” )” for each file or do I have to edit the code in some way?

Any help will be appreciated.

You can make a separate file for each item. Then you need to include them in your cl_init.lua by adding include(“anotherfile.lua”) to the top.

You also need to add a AddCSLuaFile(“anotherfile.lua”) to the top of init.lua so that the server knows to send the files to the clients.

That worked perfectly, thank you for your help :slight_smile: