Naming Conventions for Functions and Variables

When considering names, we often default to “short and sweet” names rather than more expressive choices. Short names are useful as they do provide more space for Iguana’s Annotation Windows. However, too much brevity means that they can have poor readability and impact how we use Auto-Completion!

We follow two general rules to keep names concise yet meaningful:

  1. Prefix file and functions with their logical “class” or “group”.

  2. Use camelCase for better readability.

We use this convention with our adapters. For example, in the Shell Adapter, all files and functions are prefixed with SHELL:

  • SHELLclient

  • SHELLcustom

  • SHELLmethodOne

This helps the team debug and search the code more efficiently. You can also take advantage of the Translator’s Project Search and Replace feature.

When naming variables, consider the following:

  • Choose intuitive names that clearly represent the variable’s contents.

  • Prepend Boolean variables with is (e.g., isValid instead of Valid).

  • Avoid underscores in variable names, as they can be confusing.

  • Do not start names with underscores, as this violates internal Lua rules.

  • Use single-character variables only for specific purposes:

    • Counters (i)

    • Iterators (k, v)

    • Passed variables in short functions