Skip to content

KenshiLua v0.3.7-alpha

Choose a tag to compare

@Genpretz Genpretz released this 09 Oct 05:06

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.


Screenshot 2026-10-08 221943

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):

  1. Install the Lua extension by sumneko.
  2. Extract the addon zip to a folder outside your mods, for example C:/KenshiModding/LuaLS. It contains one folder, kenshilua.
  3. 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, or nil on failure. Destroy it with ForgottenGUI:destroy before destroying its parent widget.

  • DialogActionEnum values that were missing: CHOOSE_SLAVES_SELLING, CHOOSE_SLAVES_BUYING, CHOOSE_PRISONER_BAIL, CHOOSE_CONSCRIPTION, CHOOSE_RECRUITING, CHOOSE_HIRING_CONTRACT, SURRENDER_NON_HUMANS and CHOOSE_ANIMALS_BUYING.

Fixed

  • lektor.new and ogre_unordered_set.new now 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, the CharStats tooltip methods, GameData.storeHandleList, GameData.getAllFromList, and the list methods on ForgottenGUI, FactionWarMgr, FarmBatch, FarmBuilding, Faction and CraftingBuilding.
  • Behavior change: UseableStuff.occupantSelection now returns a boolean. It previously returned a handle by mistake. Update scripts that relied on the handle.