CCSMB / Standards

Standard file formats, APIs, network protocols, and more for ComputerCraft
Other
8 stars 7 forks source link

CCSMB 4: Recommendations for Lua Code #16

Open MCJack123 opened 1 year ago

MCJack123 commented 1 year ago

This RFC adds a proper standard for recommendations for Lua code, including programs and libraries. It's divided into two types of guidelines: interface guidelines, which are required to be compliant with the spec; and style guidelines, which are recommendations by the CCSMB but not required for full compliance. This supersedes #9 by adding much more detail to how Lua files should be written.

This is not complete at the moment, but I figured it would be good to add it for now to get more feedback and suggestions for things to add.

Closes #9

totallynotmarcus commented 1 year ago

This seems to be a great addition to CCSMB. However, I would like to propose to change the name of the standard to "Recommendations for Executable Lua Source," which would indicate that this RFC exclusively defines information for Lua packages and libraries, NOT Lua tables and/or byte code, which may become their own separate standard entirely.

MCJack123 commented 1 year ago
  1. Lua/"serialized" tables aren't really Lua code in theory - the fact that they are valid Lua code and loadable by load is an implementation detail (like how JSON is technically valid JavaScript code). As such, it's by default not covered under the "Lua code" title. Even so, serialized tables should still follow the style guidelines.
  2. Bytecode is also not Lua, and is an implementation detail of the Lua VM, so it's also by default not covered as "Lua code".