Some free standing editors and editors within Integrated Development Environments (IDEs) offer quick code template insertion upon creation of file or while typing. Those features save a significant amount of time typing and verifying for typos for the lifetime of a product development.
The few code writing conventions turned into patterns used throughout the Iguana-apps repository could easily save a lot of work.
For example, if the new file dialog for a file with lua extension had an option (checkbox and a dropdown list) to create the file content with said patterns, there would be savings immediately.
From those three documented patterns above, two that could easily become templates for new files are :
1) Returning a local table: Which contains the functions for the module.
where <|> is the place the cursor would be presented when the editor opens with the new file
Why m? The actual letter choice for templating the variable is irrelevant. Because it is a local variable to hold the list of functions, so the actual name does not show outside the module and therefore it is an unnecessary hassle to name it after the file name; and by being one letter it is very short to type and unobtrusive to read; and one can think of “m”odule.
2) Returning a function: Used when a module is “single use” (there is only one function)
local function fn()
The most repeated text to type everywhere in these lua files is the very verbose
local function m. ...()
If there was a quick way to paste that leaving the cursor where the function name should be, that would be great!! Say a button or very explicit hotkey.
You must be logged in to reply to this topic.
Please don't hesitate to take anonymous feedback survey or leave us a comment.