Reading and editing config.lua
Ninety percent of the time you spend with a downloaded script is not writing code. It is opening one file, config.lua, changing a few values, and restarting. This lesson shows you what that file actually is, how a script reads it, and where the landmines are. By the end you will read any config.lua with confidence and know the difference between a safe edit and one that takes the resource offline.
What a config file is
A config.lua is just a Lua file that builds one big table and leaves it where the rest of the script can find it. There is no magic. The whole pattern is this:
Config = {}
Config.Debug = true
Config.MaxPlayers = 32
Config = {} creates an empty table, a container that holds named values. Each line after it drops one more value in under a name. Config.Debug is the name Debug inside the Config table, and you read it back the same way you set it. That is the entire idea. A real script just has more lines.
When a script author wants you to change behavior, they pull those changeable values out of the code and into this one file. You edit the file, you do not edit the code. That separation is the point of a config: the risky logic stays sealed, and the safe knobs sit in one place with your name on them.
Keep reading the full lesson
Sign in to start, then unlock every step of this lesson and the full FiveM School with a membership.
- Build it
- The keys you will meet everywhere
- Safe edits versus risky edits
- A real before/after edit
- How a bad edit breaks the resource
- If something went wrong
- What you can do now
- Try it yourself
The remainder of Reading and editing a script's config.lua is available to FiveM School members.