Skip to content

Commit b538967

Browse files
chore: autopublish 2024-01-20T22:33:39Z
1 parent a0fe5f4 commit b538967

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

docs/rgp-lua.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,13 @@ _RGP Lua_ (starting in version 0.67) pre-loads the lua-cjson 2.1.0 library, whic
103103
local cjson = require('cjson')
104104
```
105105

106+
If you are writing a script to be deployed at the [Finale Lua](https://finalelua.com) website, you must wrap the call to `require` as follows:
107+
108+
```lua
109+
local utils = require('library.utils')
110+
local cjson = utils.require_embedded('cjson')
111+
```
112+
106113
The json strings formatted by cjson are flat, containing no line feeds. If you wish to format them in human-readable format, you can use the built-in function [`prettyformatjson`](#prettyformatjson).
107114

108115
More information on how to use the cjson library is available here:
@@ -136,6 +143,13 @@ _RGP Lua_ (starting in version 0.68) pre-loads the luafilesystem library ('lfs')
136143
local lfs = require('lfs')
137144
```
138145

146+
If you are writing a script to be deployed at the [Finale Lua](https://finalelua.com) website, you must wrap the call to `require` as follows:
147+
148+
```lua
149+
local utils = require('library.utils')
150+
local lfs = utils.require_embedded('lfs')
151+
```
152+
139153
More information on how to use the lfs libray is available here:
140154
[https://lunarmodules.github.io/luafilesystem/](https://lunarmodules.github.io/luafilesystem/)
141155

@@ -149,6 +163,13 @@ _RGP Lua_ does not load the library into a global namespace, however. You must e
149163
local osutils = require('luaosutils')
150164
```
151165

166+
If you are writing a script to be deployed at the [Finale Lua](https://finalelua.com) website, you must wrap the call to `require` as follows:
167+
168+
```lua
169+
local utils = require('library.utils')
170+
local osutils = utils.require_embedded('luaosutils')
171+
```
172+
152173
The advantage to this approach is that you do not need to change the body of your script if you wish to use an external version of `luaosutils` instead of the version embedded in _RGP Lua_. Simply disable the `LoadLuaOSUtils` option in [`plugindef`](#connect-to-finalelua) and the script will pick up the external version instead, provided it is in your `cpath` list. (_RGP Lua_ automatically adds the script’s running folder path to the `cpath` list.)
153174

154175
A script must be running as trusted code to gain full access to the functions in the library. See the [readme file](https://github.com/finale-lua/luaosutils#readme) for details.

src/lib/lib/script-data.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)