You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/plugins.md
+47-5Lines changed: 47 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -70,11 +70,28 @@ local plugin = FeatherPluginManager.createPlugin(MyPlugin, "my-plugin", {
70
70
71
71
The FeatherPluginManager will handle the lifecycle of the plugin and call the appropriate functions. Here's a breakdown of the plugin lifecycle:
72
72
73
-
1.**Initialization**: The plugin is initialized with the provided options.
74
-
2.**Request Handling**: The plugin handles requests from the client.
75
-
3.**Update**: The plugin is updated every frame.
76
-
4.**Error Handling**: The plugin handles errors that occur in the game.
77
-
5.**Finish**: The plugin is finished and the game is closed.
73
+
### Initialization
74
+
75
+
-`init(config)`: This function is called when the plugin is initialized.
76
+
-`getConfig()`: This function returns the configuration for the plugin when the Feather app is initialized. Sent to the client app.
77
+
78
+
### Request Handling
79
+
80
+
-`handleRequest(request, feather)`: This function is called when a request is received. (GET)
81
+
-`handleActionRequest(request, feather)`: This function is called when an action request is received. (POST)
82
+
-`handleParamsUpdate(request, feather)`: This function is called when a params update request is received. (PUT)
83
+
84
+
### Update
85
+
86
+
-`update(dt, feather)`: This function is called every frame. (Called after the request handling)
87
+
88
+
### Error Handling
89
+
90
+
-`onerror(msg, feather)`: This function is called when an error occurs. Errors in this function will close the game abruptly. No frame is rendered after this function is called.
91
+
92
+
### finish
93
+
94
+
-`finish(feather)`: This function is called when the server is closed.
78
95
79
96
## Plugin options
80
97
@@ -114,6 +131,31 @@ function MyPlugin:getConfig()
114
131
end
115
132
```
116
133
134
+
## Using Plugin Actions
135
+
136
+
Feather plugins can also be used to trigger actions from game code at runtime.
0 commit comments