• Addon autorun file naming?
    3 replies, posted
What are the "correct" names for files in the autorun directory? Are all autorun files executed when the addon is loaded, or does it execute some specifically such as cl_init.lua, init.lua and shared.lua?
As far as I know: Inside lua/autorun: All files executed both clientside and serverside. Inside lua/autorun/client: All files executed clientside. Inside lua/autorun/server: All files executed serverside. I believe init.lua is only required with entities/weapons.
[QUOTE=Khub;45317453]As far as I know: Inside lua/autorun: All files executed both clientside and serverside. Inside lua/autorun/client: All files executed clientside. Inside lua/autorun/server: All files executed serverside. I believe init.lua is only required with entities/weapons.[/QUOTE] So it's best to create shared.lua inside lua/autorun, cl_init.lua inside lua/autorun/client and sv_init.lua in lua/autorun/server? Thanks! EDIT: Looks like load order is [code]Server: lua/autorun/shared.lua Server: lua/autorun/server/sv_init.lua Client: lua/autorun/shared.lua Client: lua/autorun/client/cl_init.lua[/code]
[QUOTE=jackwilsdon;45317465]So it's best to create shared.lua inside lua/autorun, cl_init.lua inside lua/autorun/client and sv_init.lua in lua/autorun/server? Thanks![/QUOTE] I wouldn't say it's best, it's a thing of personal preference. I usually have one shared autorun file where I take care of the actual code files residing out of lua/autorun.
Sorry, you need to Log In to post a reply to this thread.