Skip to content

Foreword

As I've forayed into the FiveM modding community, I've observed many different styles and strategies for writing Lua code. Some of these lead to code that is easy to maintain, read, and understand; while others result in code that is confusing, buggy, and less performant.

I've also learned of many behaviors specific to FiveM, or the Lua language itself, which suggest preferring certain functions over others.

I want to collect these best practices from Lua and FiveM, combined with my knowledge of clean code practices from the broader software community, within this handbook. This documentation is meant to be immediately useful and concrete, with plenty of examples of what to do, and what not to do.

However, a disclaimer; This work represents the best of my knowledge for writing effective Lua code for the GTA 5 FiveM framework. Thus, the limits of my knowledge are also reflected in this work. If I have made a mistake, please let me know.

- Manason