mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Document load() and execfile() changes
This commit is contained in:
parent
43c3fec3f3
commit
34b7a02602
1 changed files with 22 additions and 0 deletions
|
@ -115,3 +115,25 @@ if (not ok)
|
||||||
-- channel not found
|
-- channel not found
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Changed globals
|
||||||
|
|
||||||
|
#### `load(chunk [, chunkname [, mode [, env]]])`
|
||||||
|
|
||||||
|
This function behaves really similarity to Lua's `load`, however it does not allow for bytecode to be executed.
|
||||||
|
It achieves this by forcing all inputs to be encoded with `UTF-8`.
|
||||||
|
|
||||||
|
See [official documentation](https://www.lua.org/manual/5.4/manual.html#pdf-load)
|
||||||
|
|
||||||
|
#### `execfile(filename)`
|
||||||
|
|
||||||
|
This function mimics Lua's `dofile` however relative paths are relative to your plugin's directory.
|
||||||
|
You are restricted to loading files in your plugin's directory. You cannot load files with bytecode inside.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
```
|
||||||
|
execfile("stuff.lua") -- executes Plugins/name/stuff.lua
|
||||||
|
execfile("./stuff.lua") -- executes Plugins/name/stuff.lua
|
||||||
|
execfile("../stuff.lua") -- tries to load Plugins/stuff.lua and errors
|
||||||
|
execfile("luac.out") -- tried to load Plugins/name/luac.out and errors because it contains non-utf8 data
|
||||||
|
```
|
||||||
|
|
Loading…
Reference in a new issue