Lua In WK
A mod that provides a Lua API and Lua scripting support for White Knuckle using MoonSharp.
模組介紹 作者原文
LuaInWhiteKnuckle
A mod that provides a Lua API and Lua scripting support for White Knuckle using MoonSharp.
Most features must be enabled through in-game commands.
Running Lua Scripts
Use the luaFile command to execute a Lua script.
Example folders:
- LuaPerks - Prebuilt Lua examples demonstrating the available features.
- LuaPerkModules - Custom PerkModule implementations for more complex perk behavior.
- LuaScript - Miscellaneous testing scripts.
Note: Some APIs marked in comments are still under development and may be renamed in future versions.
Writing Lua Scripts
Example scripts can be found in:
- LuaPerks
- LuaPerkModules
Source code:
*
For Hooks and Events, refer to:
- LuaPerkModules
- The GitHub source code
Writing Lua APIs
Register an assembly for automatic scanning:
PluginRegistry.RegisterAssembly(Assembly assembly);
LuaApi
[LuaApi("LuaObjectName")]
Registers a Lua object.
Requirements:
- A parameterless constructor.
- All public methods, fields, and properties will automatically become accessible from Lua.
LuaData
[LuaData(typeof(DataType))]
Registers an automatic conversion type.
This is mainly used to expose a safe proxy of a C# class instead of the original implementation, allowing dangerous APIs to be restricted before reaching Lua.
Hooks & Events
See the implementation inside:
- ModRootApi
Acknowledgements
This project is built on top of the excellent MoonSharp Lua interpreter.
Special thanks to the MoonSharp project and its contributors for making Lua scripting integration with.NET possible.
- MoonSharp GitHub:
Notes
I'm too lazy to write a proper README right now.
So... this is the README.
安裝與使用 安裝:按包內說明操作
- 解壓本站下載的壓縮包,先讀包內的 readme / 說明檔案。
- 多數模組依賴遊戲的模組載入器:常見做法是用社群模組管理器(如 r2modman)選中本遊戲安裝,由管理器自動處理載入器與依賴。
- 手動安裝時,把模組檔案放進遊戲目錄下對應的 Mod / plugins 資料夾。
- 啟動遊戲確認載入成功;帶「前置依賴」的模組需要把依賴一併安裝。
不同模組的安裝位置差異較大,包內說明是最可靠的依據。