diff options
author | Matthieu Coudron <886074+teto@users.noreply.github.com> | 2024-02-14 21:27:57 +0100 |
---|---|---|
committer | Matthieu Coudron <886074+teto@users.noreply.github.com> | 2024-03-06 22:54:01 +0100 |
commit | 0bdfbc9e6a721f2299dfb0d072d5052d4b287802 (patch) | |
tree | fd8301be369b4c1efdb8afdbc278e0718790df71 /doc/languages-frameworks | |
parent | 2e5f2d26502c889fd46f40ed8e4de2cd1465a1e6 (diff) |
doc/lua.section.md: update lua documentation
Diffstat (limited to 'doc/languages-frameworks')
-rw-r--r-- | doc/languages-frameworks/lua.section.md | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/doc/languages-frameworks/lua.section.md b/doc/languages-frameworks/lua.section.md index 136c7194e5cd..a6577a56a436 100644 --- a/doc/languages-frameworks/lua.section.md +++ b/doc/languages-frameworks/lua.section.md @@ -1,8 +1,8 @@ -# User’s Guide to Lua Infrastructure {#users-guide-to-lua-infrastructure} +# Lua {#lua} -## Using Lua {#using-lua} +## Using Lua {#lua-userguide} -### Overview of Lua {#overview-of-lua} +### Overview of Lua {#lua-overview} Several versions of the Lua interpreter are available: luajit, lua 5.1, 5.2, 5.3. The attribute `lua` refers to the default interpreter, it is also possible to refer to specific versions, e.g. `lua5_2` refers to Lua 5.2. @@ -118,7 +118,7 @@ Again, it is possible to launch the interpreter from the shell. The Lua interpreter has the attribute `pkgs` which contains all Lua libraries for that specific interpreter. -## Developing with Lua {#developing-with-lua} +## Developing with lua {#lua-developing} Now that you know how to get a working Lua environment with Nix, it is time to go forward and start actually developing with Lua. There are two ways to @@ -234,30 +234,20 @@ The `lua.withPackages` takes a function as an argument that is passed the set of Using the `withPackages` function, the previous example for the luafilesystem environment can be written like this: ```nix -with import <nixpkgs> {}; - lua.withPackages (ps: [ps.luafilesystem]) ``` `withPackages` passes the correct package set for the specific interpreter version as an argument to the function. In the above example, `ps` equals `luaPackages`. -But you can also easily switch to using `lua5_2`: +But you can also easily switch to using `lua5_1`: ```nix -with import <nixpkgs> {}; - -lua5_2.withPackages (ps: [ps.lua]) +lua5_1.withPackages (ps: [ps.lua]) ``` -Now, `ps` is set to `lua52Packages`, matching the version of the interpreter. - -### Possible Todos {#possible-todos} - -* export/use version specific variables such as `LUA_PATH_5_2`/`LUAROCKS_CONFIG_5_2` -* let luarocks check for dependencies via exporting the different rocktrees in temporary config +Now, `ps` is set to `lua5_1.pkgs`, matching the version of the interpreter. -### Lua Contributing guidelines {#lua-contributing-guidelines} +### Lua Contributing guidelines {#lua-contributing} Following rules should be respected: -* Make sure libraries build for all Lua interpreters. * Commit names of Lua libraries should reflect that they are Lua libraries, so write for example `luaPackages.luafilesystem: 1.11 -> 1.12`. |