Dwarf Fortress Remote server contains a lot of Lua code, and now that I’m adding support for more DF versions, I need to make sure all my code is updated as DF data structures change. I could probably just diff data structure definition files, but I’d like to have a less time consuming and more reliable solution.
So I started to work on a tool that automatically checks Lua scripts and shows access to wrong fields, incorrect assignments and so on – things that a compiler would show errors for, were Lua a statically typed language.
Here it is: https://github.com/mifki/df-luacheck
It’s a work in progress, with a lot of unsupported things, including
require statements and built-in DFHack library functions, so it can’t be used to check real scripts yet, but I’ll improve it until it can check all of the DF Remote code and show what needs to be fixed for 0.42. Some examples of what it can do below.