Skip to content
Back to skills

Glua

ASecurity

Garry's Mod / GLua development guide — realms (SERVER/CLIENT, AddCSLuaFile), the net library and exploit-safe net.Receive/concommand handlers, NW/NW2/NetworkVar choice, performance in hot hooks (Think, HUDPaint, SetupMove) for high player counts, SENT/SWEP structure and prediction, hook return semantics, VGUI/Derma, DarkRP addons, and linting with glualint. Use whenever reading, writing, reviewing or debugging Lua for Garry's Mod — files under garrysmod/, gamemodes/, addons/, lua/autorun, lua...

  • 3 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 17, 2026
ai-agentsrustgosqldebuggingapisecurityperformance

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 20 files and shows the line behind each finding

Scanned November 17, 2026

npx -y skills add neffR/glua-skill --skill glua --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Glua?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Glua
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/neffr-glua/badge)](https://www.skillsdirectory.com/skills/neffr-glua)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: glua
description: Garry's Mod / GLua development guide — realms (SERVER/CLIENT, AddCSLuaFile), the net library and exploit-safe net.Receive/concommand handlers, NW/NW2/NetworkVar choice, performance in hot hooks (Think, HUDPaint, SetupMove) for high player counts, SENT/SWEP structure and prediction, hook return semantics, VGUI/Derma, DarkRP addons, and linting with glualint. Use whenever reading, writing, reviewing or debugging Lua for Garry's Mod — files under garrysmod/, gamemodes/, addons/, lua/autorun, lua/entities, lua/weapons — or when the user mentions GMod, GLua, Garry's Mod, DarkRP, SENT, SWEP or Derma.
---

# Garry's Mod (GLua) development

GLua is Lua 5.1 on LuaJIT with C-style syntax extensions and the Source engine API.
Most GMod bugs come from five places: the wrong realm, trusting the client, doing
work every frame or tick, networking too much, and hook return values. Keep these
in mind on every change.

## Core rules

1. **Know the realm of every line.** `SERVER` / `CLIENT` globals, file prefixes
   (`sv_`, `cl_`, `sh_` or `_sv`, `_cl`, `_sh` suffixes) and the load path decide
   where code runs. A client file the server never `AddCSLuaFile`s does not exist
   on the client. See [realms](references/realms.md).
2. **Everything sent to clients is public.** Client and shared files can be read
   by any player. No secrets, keys, admin-only logic or server-side prices there.
3. **Never trust the client.** Every `net.Receive` on the server and every
   `concommand.Add` is a public API. Validate the player, rate, distance,
   permissions, types and ranges, and recompute prices or rewards on the server.
   See [security](references/security.md).
4. **`IsValid(x)` before using entities, players and panels**, and again inside
   timers, callbacks and async results — the object may be gone by then. `NULL`
   is truthy, so `if ent then` is not a validity check.
5. **Hooks: a non-nil return stops the chain.** Returning `false` or any value
   from a `hook.Add` callback blocks every later callback and the gamemode
   function. Only return when you mean to override. See [hooks](references/hooks-gamemode.md).
6. **Hot paths stay cheap.** `Think`, `Tick`, `HUDPaint`, `PostDrawOpaqueRenderables`,
   `SetupMove`, `PlayerTick`, `ENT:Think`, `PANEL:Paint` run every frame or tick,
   often per player. No `ents.GetAll`/`ents.FindByClass` scans, no allocations
   (`Color()`, `Vector()`, `Material()`, string building), no `surface.CreateFont`,
   no SQL or file I/O there. Cache and throttle. See [performance](references/performance.md).
7. **Network the minimum, at the lowest frequency.** Prefer event-driven `net`
   messages with explicit bit widths over per-tick updates and `net.WriteTable`.
   Pick NW2/NetworkVar/net deliberately. See [networking](references/networking.md).
8. **Entity and weapon code has its own rules** — `SetupDataTables` slot limits
   (4 strings), prediction in SWEPs (`IsFirstTimePredicted`), transmit state.
   See [entities and weapons](references/entities-weapons.md).
9. **GLua syntax is not standard Lua.** `//` is a comment, not integer division;
   there are no bitwise operators (use `bit.*`); `!=`, `!`, `&&`, `||` and
   `continue` exist. See [language](references/language.md).
10. **Lint with glualint, not `luac`.** `luac` rejects valid GLua. Run
    `scripts/lint.sh <files>` (wraps glualint) after every edit. `[Error]` =
    won't load; most `[Warning]`s are style, but `Silly negation`,
    `Duplicate key`, `Unused variable`, `shadows`, `Deprecated` are usually
    real bugs. Don't reformat untouched code. See [tooling](references/tooling.md).
11. **Match the codebase.** Follow the project's existing naming, file layout,
    libraries (DarkRP, ULX/SAM, MySQLOO, custom hook or netvar libraries) and
    style before introducing your own. Projects often replace `hook` or add
    their own networking layer — check before assuming stock behaviour.

## Reference files

Read the one that matches the task; they are not needed for every edit.

| File | Read when |
|---|---|
| [references/language.md](references/language.md) | Syntax questions, LuaJIT limits, tables, strings, common language traps |
| [references/realms.md](references/realms.md) | Adding files, load order, `include`/`AddCSLuaFile`, autorun, gamemode/addon layout |
| [references/networking.md](references/networking.md) | Sending data between realms, choosing NW/NW2/NetworkVar/net, bandwidth |
| [references/security.md](references/security.md) | Writing or reviewing `net.Receive`, `concommand`, SQL, `RunString`, money/items |
| [references/performance.md](references/performance.md) | Anything in hot hooks, servers with many players, FPS/tick problems |
| [references/entities-weapons.md](references/entities-weapons.md) | SENTs, SWEPs, NPCs, physics, prediction, transmit |
| [references/hooks-gamemode.md](references/hooks-gamemode.md) | Hooks, gamemode functions, DarkRP hooks/API, timers |
| [references/ui.md](references/ui.md) | VGUI/Derma, `surface`/`draw`, fonts, scaling, DHTML |
| [references/ecosystem.md](references/ecosystem.md) | Permission checks (CAMI, ULX), prop ownership (CPPI), MySQLOO queries, TTT as a model for secret state |
| [references/tooling.md](references/tooling.md) | Reading glualint output, `.glualint.json`, finding accidental globals, profiling with FProfiler |
| [references/pitfalls.md](references/pitfalls.md) | Something "silently stopped working"; reviewing entry points, rate limits, async/state code, join/Think performance — real bugs from a live server |

## Before saying "done"

- [ ] `scripts/lint.sh <changed files>`: no `[Error]`, no new "likely bug" warnings; remaining style warnings are pre-existing and mentioned.
- [ ] Every new file is in the right realm and reachable: `include` + `AddCSLuaFile` where needed.
- [ ] Every new or changed `net.Receive`/`concommand` validates player, rate, and inputs on the server.
- [ ] Every new `util.AddNetworkString` runs on the server at load time.
- [ ] Nothing new runs per frame/tick without a reason; nothing allocates or scans entities there.
- [ ] Entity references in timers/callbacks are re-checked with `IsValid`.
- [ ] No hook callback returns a value unless it intends to override.
- [ ] No secrets or server-only logic in files sent to clients.
- [ ] Tell the user what could not be verified without running the game (behaviour in-game, prediction, multiplayer timing).

Files in this skill

  • SKILL.md6.3 KB
  • evals/admin-bonus-command-mysql/case.yaml473 B
  • evals/admin-bonus-command-mysql/graders/01-the-permission-is-checked-through.md292 B
  • evals/admin-bonus-command-mysql/graders/02-the-mysql-insert-uses-a.md240 B
  • evals/admin-bonus-command-mysql/graders/03-the-amount-argument-is-validated.md174 B
  • evals/admin-bonus-command-mysql/graders/04-the-code-handles-the-command.md151 B
  • evals/admin-bonus-command-mysql/graders/05-any-code-running-inside-an.md190 B
  • evals/admin-bonus-command-mysql/graders/06-the-code-has-no-runtime.md173 B
  • evals/admin-bonus-command-mysql/graders/07-privilegeaccess-registration-does-not-de.md240 B
  • evals/admin-bonus-command-mysql/prompt.md658 B
  • evals/cami-privilege-denied-under-ulx/case.yaml474 B
  • evals/cami-privilege-denied-under-ulx/files/sv_shop_admin.lua679 B
  • evals/cami-privilege-denied-under-ulx/graders/01-the-response-identifies-that-the.md167 B
  • evals/cami-privilege-denied-under-ulx/graders/02-the-response-explains-why-it.md269 B
  • evals/cami-privilege-denied-under-ulx/graders/03-the-fix-registers-the-privilege.md271 B
  • evals/cami-privilege-denied-under-ulx/graders/04-the-fixed-callback-re-checks-isvalidply.md146 B
  • evals/cami-privilege-denied-under-ulx/place-files.sh62 B
  • evals/cami-privilege-denied-under-ulx/prompt.md560 B
  • evals/entindex-reuse-autoremove/case.yaml478 B
  • evals/entindex-reuse-autoremove/files/sv_autoremove.lua499 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.