From 38b17e7db5bd0595cd9874cfa1ce0670dacde106 Mon Sep 17 00:00:00 2001 From: Maxwell Jeffress Date: Mon, 25 Aug 2025 14:10:14 +1000 Subject: [PATCH] Add library guide --- docs/library-guide.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 docs/library-guide.md diff --git a/docs/library-guide.md b/docs/library-guide.md new file mode 100644 index 0000000..8d62953 --- /dev/null +++ b/docs/library-guide.md @@ -0,0 +1,21 @@ +# Guide to Writing Libraries in Ground + +Ground has a "use" keyword which allows you to import libraries written in Ground, executing the code, and importing functions for use. This makes building reproducable bits of code very easy. + +This is a guide of best practices which should be followed. + +## .grnd file extension + +The Ground interpreter will automatically append ".grnd" when you use a library. If you write `use "myLibrary"` Ground will look for "myLibrary.grnd". This is a must-do. + +## camelCase Function and File Names + +For consistency, please use camelCase (with a lower case first letter) when naming functions and file names. + +## Don't use spaces + +It is impossible to use spaces in Ground function names. Please do not use spaces in file names, even though it will work. + +## Use functions for most operations + +Where possible, create functions to do everything needed with your library. You can include some code for initialisation, but don't do the entirety of your operations outside of your functions.