Making a Config.lua [Support]

HI, I start off this afternoon as to ask “How would I make a config?”, aha yes by now you’re thinking… “Dude, defug?”. But seriously the problem I’m trying to workout in my tiny little brain is howto make a config (Like I already said). But a config for what may I ask myself? Ah, well I’m working on my own printer and instead of digging into the file to change the print amount for that specified printer I’d just prefer to make a config for that printer, this is what I have in mind…


 -- Just something as basic as this.

GAMEMODE.Config.smartprintamount = "value here"



So could I put this in the printer folder instead of going into the printer file “init.lua” to change the values?
Could I make a config file inside the printer folder “smart_printer”?

Thanks for reading, your time and god blesses you!

Elaborate on what exactly you are trying to do because form your explanation I can’t get a clear idea. If you are just looking to make a config in a lua file the way you have it works fine.

Here is an example of a config I made for one of my addons.

[lua]SimpleAdverts.OverrideID = “STEAM_0:0:00000000” --Who ever’s steam id that is in this will be able to add adverts no matter the parameters below.
–This is useful if you are the owner of the server and you want to be the only one that can add adverts.

SimpleAdverts.ADMIN = true – Can admins add adverts? If no then set to false.
SimpleAdverts.SUPERADMIN = true – Can super admins add adverts? If no then set to false.

–The command that is enterd in chat to open the advert menu.
–The prefix ! or / can be used with the command. You do not have to include them Example: !samenu or /samenu
SimpleAdverts.MENUCOMMAND = “samenu”

–This is the amount of time in between each advert.
–It is measured in minutes.
SimpleAdverts.PRINTDELAY = 10
[/lua]

Okay, I mean a money printer for DarkRP. so instead of me going into the “init.lua” file to change values of printing amount or speed it prints I’m saying is it possible to make a folder called config.lua and that config will be like an easy shortcut instead of going into the “init.lua” to change the values.

Make sure you do this, as well



Example = {}

Example.SmartPrintAmount = "whatever"


What she said. I forgot to include that part because my table is created when the server side int loads and therefor is not in my config file.

Example of how I did config on my addon:

If you want to have it in a seperate file just put:
[lua]include(path/to/file)[/lua]
at the top of your init file. (After table declaration)