Thank you for considering contributing to this project! It's people like you that make the open source community a great place to learn, inspire, and create.
These are recommended, but not enforced yet. We follow slightly similar commit guidelines to YimMenu:
<type>(scope): <description>
[optional body]
[optional footer]
-
Types (lowercase only):
- feat: New features.
- fix: Bug fixes.
- style: Feature and updates related to styling.
- refactor: Refactoring a specific section of the codebase.
- test: Everything related to testing.
- docs: Everything related to documentation.
- chore: Regular code maintenance.
-
Scope:
- A scope is a phrase describing parts of the code affected by the changes. For example
(translations).
- A scope is a phrase describing parts of the code affected by the changes. For example
-
Body (Optional):
- The commit body can provide additional contextual information. For breaking changes, the body MUST start with "BREAKING CHANGE".
-
Footer (Optional):
- A commit footer is used to reference issues affected by the code changes. For example: "Fixes #13". It can also be used to indicate breaking changes by starting with "BREAKING CHANGE".
-
Example:
fix(SomeFeature): fix constructor returning an empty object. docs(Readme): document coding conventions
Annotate all enums, classes, and class methods using LuaLS's style.
Annotations are critical for readability, code completion, error checking, and automatic generation of class documentations.
For comments/summaries/descriptions, you can use either 2 or 3 dashes but please leave a space between the last dash and the text.
-
Example:
-- Calculates the sum of two numbers. ---@param a number The first number ---@param b number The second number ---@return number The sum of both numbers function MyClass:Add(a, b) return a + b end
There are two ways to declare globals:
-
Globals that should be serialized to JSON: Index the global
GVarstable. Even if the variable was never declared before:GVars.some_feature_enabled, _ = ImGui.Checkbox("My Checkbox", GVars.some_feature_enabled)
-
Regular globals: Use Lua's default global table
_G:some_global_number = 123
You are free to use any style you want, except in these cases:
| Scope | Naming | Example |
|---|---|---|
| Global Functions | PascalCase | function DoSomething(...) end |
| Local Functions | any (consistent) | You are free to use any style as long as it stays consistent throughout the whole file |
| Standard Lib Extensions | Use the lib's default style | string.somefunc = function(...) end |
| Enums | PascalCase prefixed with a lowercase e |
eExampleEnum |
| Enum Members | Preferably UPPER_SNAKE_CASE but PascalCase is also allowed | eExampleEnum.SOME_MEMBER/eExampleEnum.SomeMember |
| Classes | PascalCase | MyNewClass = Class("MyNewClass") |
| Class Methods | PascalCase | function MyNewClass:ExampleMethod(...) end |
| Class Members | snake_case prefixed with an m |
m_handle |
-
Indentations:
- Indentation and empty spaces are handled by .editorconfig. Please make sure you have it in your workspace.
-
Line Wrapping:
-
Try to wrap wide lines using either your IDE's formatter or a Pythonic way.
-
Example:
SomeFunc(param1, param2, param3, param4, param5, param6, param7, param8, param9, ...)
-
Preferred (Pythonic) style:
SomeFunc( param1, param2, param3, param4, param5, param6, param7, param8, param9, ... )
-
-
-
Nested
ifStatements:-
Always try to use guarded if statements when applicable.
-
Example:
local cond_1 = false local cond_2 = nil local cond_3 = true if cond_1 then if cond_2 then if cond_3 then DoSomething() end end end
-
Preferred approach:
local cond_1 = false local cond_2 = nil local cond_3 = true if not cond_1 then return end if not cond_2 then return end if not cond_3 then return end DoSomething()
-
Shorter version:
local cond_1 = false local cond_2 = nil local cond_3 = true if not (cond_1 and cond_2 and cond_3) then return end DoSomething()
-
-
- The primary language for all labels is English (US) (
includes/lib/translations/en-US.lua). - To add a new language, add its name and ISO code to
includes/lib/translations/__locales.lua. - To add a new label, update
/lib/translations/en-US.lua. - All other language files will be automatically generated via GitHub Actions.
Suppose you want to draw some text that gets automatically translated:
-
Open
includes/lib/translations/en-US.lua. -
Add a key-value pair for your new label:
return { ... ["MY_LABEL"] = "My label's text in English." }
-
Use the
keywith the_Twrapper for theTranslator:Translate(...)method:ImGui.Text(_T("MY_LABEL"))
-
Open
includes/lib/translations/__locales.lua. -
Add a new language dictionary
{ name, iso }:return { ..., -- pre-existing tables { name = "Türkçe", iso = "tr-TR" }, -- Your new language }
The project is organized by responsibility rather than feature size. Folders define architectural boundaries and expected usage patterns.
├─ includes/
│ ├─ classes/
│ │ └─ gta/ # Contains reverse-engineered game classes mostly sourced from Yimura's archived repository and others I reversed myself using a mix of debuggers, public research, and personal suffering.
│ │
│ ├─ data/ # A place where all raw data is stored.
│ │ ├─ actions/ # Contains YimActions V3 data (animations, scenarios, synchronized scenes, and movement clipsets).
│ │ └─ enums/ # Groups all game and custom enums in one place under one `Enums` global namespace.
│ │
│ ├─ features/ # Stores all script features.
│ │ ├─ self/ # Player-specific features.
│ │ ├─ vehicle/ # Vehicle-specific features.
│ │ └─ world/ # World-specific features.
│ │
│ ├─ frontend/ # This is where UI tabs live.
│ │
│ ├─ lib/ # Contains project libraries and commands: API extensions, translations, Lua standard library extensions, global utilities, etc.
│ │
│ ├─ modules/ # Contains custom modules such as native wrappers, game entity abstractions, and higher-level gameplay utilities.
│ │
│ ├─ services/ # Contains runtime services (GUI, KeyManager, Serializer, CommandExecutor, etc.)
│ │
│ ├─ structs/ # Stores helper structs.
│ │
│ ├─ thirdparty/ # Thirdparty components and their license texts.
│ │
│ ├─ backend.lua # Central backend module providing lifecycle coordination, entity management, and API/script version checks.
│ ├─ version.lua # This is purely for CI and should never be edited. It stores the latest script version.
│ └─ init.lua # Initializes the whole project.
│
└─ samurais_scripts.lua # Main entry point that calls `init.lua`, handles late initialization for a few modules/services, and lazily populates a few data sets in a fiber.| Addition | Home | Notes |
|---|---|---|
| A gameplay feature | includes/features/ |
Features are behavior, not UI. |
| A UI tab or layout code | includes/frontend/ |
UI only. No game logic. |
| A reusable system with lifecycle | includes/services/ |
Must be explicitly initialized. |
| A reverse-engineered game structure or a custom Lua class | includes/classes/ |
- |
| A lightweight data container or object | includes/structs/ |
No lifecycle, no side effects. |
| Raw static data (tables, lists, maps) | includes/data/ |
Never execute logic here. |
| A native wrapper or abstraction | includes/modules/ |
Bridges Lua <-> game engine. |
| Utility or extension code | includes/lib/ |
Generic helpers and API/stdlib extensions. |
| Initialization or bootstrapping | init.lua / backend.lua |
Do not add features here. |
| A third party module from somewhere/someone else | includes/thirdparty |
Place in a subfolder accompanied with the module's license (when applicable). |
- Manually editing any language file except
en-US.lua. They are auto-generated so any changes you add will be overwritten by GitHub Actions. - Contributing licensed open source code from other developers without permission, credits, or original license (when applicable).
- Adding high-risk online options without clear and concise user warnings.