as far as the eye can see
Maybe I'll split this repository up at some point. For now, it's a monolithic repo containing a bunch of fun lua-based projects I've built.
Assign require
calls to local variables. This allows imports to be scoped to the current file and
lets us rename imports.
-- GOOD
local my_class = require 'path.to.my_class'
-- BAD
require 'path.to.my_class'
Use dots as delimiters between package names in a require statement. Dots are platform-agnostic, unlike forward or back slashes which are handled differently in different contexts.
-- GOOD
local my_class = require 'path.to.my_class'
-- BAD
local my_class = require 'path/to/my_class'
local my_class = require 'path\\to\\my_class'
Omit the .lua
file extension from require paths. They just add clutter. The path variable should
automatically append queries with the .lua
extension.
-- GOOD
local my_class = require 'path.to.my_class'
-- BAD
local my_class = require 'path.to.my_class.lua'
Do not put parenthesis around string literals for require
calls. They're cumbersome to write and
even more cumbersome to read.
-- GOOD
local my_class = require 'path.to.my_class'
-- BAD
local my_class = require('path.to.my_class')