Skip to content
This repository was archived by the owner on Sep 6, 2023. It is now read-only.

Commit 21d8a94

Browse files
api reference
1 parent 113c2c1 commit 21d8a94

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

LuaApiReference.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ The `main.lua` must define 3 functions otherwise things will explode.
3030
```lua
3131
function init()
3232
-- this runs once at when loading the extension
33-
-- if you want to register a custom keybinding: ofs.Bind must be called here
33+
-- custom keybinding are registered here with "ofs.Bind"
3434
end
3535

3636
function update(delta)
@@ -46,12 +46,14 @@ function gui()
4646
end
4747
```
4848

49-
49+
One of the biggest differences to the older Lua scripting API is that Extensions can have their own state.
50+
When an Extension gets enabled it gets it's own Lua VM seperate from other extensions.
5051

5152
# Core API
5253
| Call |Params| Returns | Description |
5354
| ----------- |------| ------- |----------- |
54-
| `print(msg)`|String| nil | Will print to the OFS log file.|
55+
| `print(msg)`|String| nil | Will print to the "Extension Log Output".<br/>Accessible through "Extensions"->"Show logs"|
56+
| `clamp(val, min, max)`| Number, Number, Number | Number | Clamps a value.<br/>This is a Lua function which I placed in global scope. |
5557
| `ofs.Bind(functionName, description)` |String, String| nil | Will create a "Dynamic" key binding.<br/>Must be called from within `init()`.<br/>Bindings will always run in another thread. |
5658
| `ofs.Task(functionName)` | String | nil |Will run a function in another thread. Use cautiously. |
5759
| `ofs.ExtensionDir()` | None | String | Path to extension directory. |

0 commit comments

Comments
 (0)