Repository navigation
KenshiLua v0.3.7-alpha
Full Changelog: v0.3.6-alpha...v0.3.7-alpha
This release adds the first Lua Language Server (LuaLS) addon for KenshiLua, a new GUI binding, and fixes for container and list bindings.
Downloads
KenshiLua v0.3.7-alpha.zip: the mod. Install it as before.KenshiLua-LuaLS-Addon-v0.3.7-alpha.zip: editor definitions for the KenshiLua API. Optional; see below.
New: LuaLS addon
With the addon, your editor completes KenshiLua globals, classes, methods, enums and event names. It also shows their types and descriptions, and warns about wrong argument types and unchecked nil values. The definitions are generated from KenshiLua's bindings, so they cover the whole registered API (though not everything has descriptions written for them). If you encounter anything that seems like an error please create an Issue or PR.
The addon is for your editor only. Kenshi never loads it, so do not put it in a mod's scripts folder.
Setup (VS Code):
- Install the Lua extension by sumneko.
- Extract the addon zip to a folder outside your mods, for example
C:/KenshiModding/LuaLS. It contains one folder,kenshilua. - In your mod's root folder (the folder you open in VS Code), create
.luarc.json:
{
"runtime.version": "LuaJIT",
"workspace.library": [
"C:/KenshiModding/LuaLS/kenshilua/library"
]
}Open a script and hover over getGameWorld. You should see its type instead of Undefined global.
To use the addon in every mod, add "Lua.workspace.userThirdParty": ["C:/KenshiModding/LuaLS"] to your VS Code user settings. Then enable kenshilua in each mod with Lua: Open Addon Manager. The addon's README.md covers both setups.
Use the addon zip from the same release as your KenshiLua DLL, and replace the kenshilua folder when you upgrade. Definitions from a different release can hide members that exist or list members that don't.
Added
-
ForgottenGUI:createDatapanel, in two forms:createDatapanel(name, win, scrolls)creates a datapanel inside any MyGUI widget.createDatapanel(top, left, width, height, scrolls, layer, window)creates one at screen-relative coordinates on a layer.
Both return the
DatapanelGUI, ornilon failure. Destroy it withForgottenGUI:destroybefore destroying its parent widget. -
DialogActionEnumvalues that were missing:CHOOSE_SLAVES_SELLING,CHOOSE_SLAVES_BUYING,CHOOSE_PRISONER_BAIL,CHOOSE_CONSCRIPTION,CHOOSE_RECRUITING,CHOOSE_HIRING_CONTRACT,SURRENDER_NON_HUMANSandCHOOSE_ANIMALS_BUYING.
Fixed
lektor.newandogre_unordered_set.newnow accept an element type without*, as documented. For example,lektor.new("Character")previously failed with "unsupported or unknown type".- Methods that read or return certain lists no longer crash. Affected methods include
ToolTip.setup_stringpairs,DatapanelGUI.setLines,RootObject.getGUIDataCategories, theCharStatstooltip methods,GameData.storeHandleList,GameData.getAllFromList, and the list methods onForgottenGUI,FactionWarMgr,FarmBatch,FarmBuilding,FactionandCraftingBuilding. - Behavior change:
UseableStuff.occupantSelectionnow returns a boolean. It previously returned a handle by mistake. Update scripts that relied on the handle.