- Overview
- File Structure and Require Aliases
- Typing Conventions
- Variable and Naming Rules
- Immutable Shared Modules
- Miscellaneous Rules
- Example File Structure
- Issues and Pull Requests
- Summary Checklist
This document defines the procedure, coding standards, type system expectations, project layout rules, and module interaction guidelines for this codebase.
These guidelines exist to ensure consistency, maintainability, and compatibility across the client/server/shared boundary. All contributors must follow them strictly.
@clientmust only be used in client-side scripts (scripts under./src/client/)@servermust only be used in server-side scripts (scripts under./src/server/)@sharedmust not be used in source files inside./src/shared/- Doing so results in invalid paths when transformed by Darklua due to shared modules being duplicated on both client and server folders
All scripts should follow this order:
- Type module requires
- Type definitions
- Actual logic
Every type definition or class must use the @class and @type annotations properly.
Use block docstrings (--[=[ ... ]=]) for:
- Class descriptions
- Function documentation
- Field explanations
Example:
--[=[
@class MyClass
This class handles X and Y logic.
]=]- Use
--!nolintdirectives unless if it's required for security reasons (e.g. unreference a sensitive token) - Use
(x :: unknown) :: any, orx :: anycasts unless there is no other solution (e.g.getmetatablegiving out a type error, even though the given value will always be a table).
| Element | Convention | Example |
|---|---|---|
| Constants | CONSTANT_CASE |
local MAX_CLOCK_DELTA = 5 |
| Local variables | camelCase |
local isTimeRespected = clockDelta < MAX_CLOCK_DELTA |
| Function parameters | camelCase |
function(shouldSearchTables, ...) |
| Local functions | camelCase |
local function performStartCheckpoint() |
| Class/Module references | PascalCase |
local DetectionManager = {}, local CommonUtilities = require("@shared/CommonUtilities.luau" |
| Class/Module functions | PascalCase |
Person:Greet(), CommonUtilities.WipeTable |
| Roblox Instances/Services | PascalCase |
CoreGui, RunService, ReplicatedStorage, HumanoidRootPart, "Humanoid" |
- Use
snake_case - Use global variables (unless needed for detection logic)
Modules inside ./src/shared/ are duplicated and isolated on both the client and the server.
You must never mutate or write to tables returned by shared modules.
If you attempt to modify their return values, it will not reflect on the opposite execution context.
Bad example:
--// DON'T DO THIS
local SharedFoo = require("@shared/SharedFoo")
SharedFoo.SomeValue = 123 --// Will not sync between client and server- Functions like
ReportAnomalyManualmust always perform strict signature validation before accepting input - Shared cryptographic state (e.g. validation seeds) must be derived from deterministic, non-sensitive values unless otherwise required
- Avoid unnecessary allocations inside detection functions (e.g., large table creations, heavy string operations)
For reference, here's a minimal layout of a compliant Luau module:
local Types = require("@shared/Types/MyTypes")
--[=[
@class MyManager
Handles core logic of detection routing.
]=]
export type MyManager = {
--[=[
The amount of times that `MyManager::Greet` was called.
]=]
GreetingCount: number,
--[=[
Method that greets a given person of name `x`.
@param x The name of the person to greet.
@return The greeting, as a string.
]=]
Greet: (x: string) -> string
}
--[=[
@class MyManager
Handles core logic of detection routing.
]=]
local MyManager = {} :: MyManager
function MyManager.Greet(x: string): string
return "Hello, " .. x
end
return MyManagerOnly submit issues that are specific, and relevant to the project.
Include:
- A clear description
- Steps to reproduce (if applicable)
- Expected behavior and actual behavior
- Logs or error messages if available
Issues that are vague or incomplete may be closed without notice.
Make your changes in a separate branch if you have write access, otherwise make them in a fork, ideally named after the feature or fix
- e.g., for branches:
feature/token-verification,fix/auth-race - e.g., for forks:
oneanticheat-feature-token-verification,oneanticheat-fix-auth-race
Then check the following:
- Ensure all code follows the guidelines outlined above
- Include tests or usage examples when applicable
- Use descriptive commit messages and PR titles
- Reference any related issues using
Fixes #issueNumberin the PR description - Do not include unrelated formatting or refactors in a single PR
- Keep your PR scope focused and atomic
All pull requests will be subject to manual review.
- Use
camelCasefor variables,PascalCasefor classes/Instances - Never use
@sharedin./src/shared - Use
@clientand@serveronly in correct contexts - Types and classes are fully typed and documented
- Shared modules are treated as immutable
- File layout follows: types first, logic after
- PRs are focused, atomic, and pass all checks