The code that the gmock macros end up generating appears to obscure the type mismatch so there's no warning (in msvc on my system anyway) no matter what types are involved, for clarity the comparison ends up being between std::pair<int, unsigned int> and testing::Pair<int, testing::AllOf<testing::Matchers<unsigned int>>>
Fully migrates debug commands to Lua and organizes them into logical
groups.
The CLI `+` syntax now runs Lua, e.g.:
```bash
build/devilutionx '+dev.player.trn.plr("infra")'
```
Chat hotkeys run Lua code if they start with `/lua`, e.g.:
```ini
[NetMsg]
QuickMessage1=/lua message(dev.player.info())
```
1. `Events` global is replaced with `require('devilutionx.events')`.
2. Table is simplified and documented.
3. `On` removed from the event names as it was a bit redundant.
4. Functions are camelCase for consistency (e.g. `add` instead of
`Add`).
Example script:
```lua
local events = require("devilutionx.events")
local render = require("devilutionx.render")
local message = require("devilutionx.message")
local function greet()
message("Hello from " .. _VERSION)
print("Hello from ", _VERSION)
end
events.GameStart.add(greet)
local function drawGreet()
render.string("Hello from " .. _VERSION, 10, 40)
end
events.GameDrawComplete.add(drawGreet)
```
Runs lua/repl_prelude.lua at console initialization.
The default prelude contains global assignments for all devilutionx
modules. This should save us on typing.
Implements a `require` function that supports built-in modules like so:
```lua
local log = require('devilutionx.log')
```
It falls back to reading from assets, so this loads `lua/user.lua`:
```lua
local user = require('lua.user')
```
The bytecode for the asset scripts is cached, in case we want to later
support multiple isolated environments.
There may be a simpler or better way to do this.
It's good enough for now until someone more knowledgeable
about Lua comes along.
Scrolling: PageUp/Down and mouse wheel.
History navigation:
* Up/Down navigates the input history.
* Shift+Up/Down navigates the output history (allowing us to copy/paste the
outputs, I imagine this will be very handy).
* Duplicates are skipped.
Enabled only in Debug mode.
Runs Lua similar to the `lua` CLI.
Supports multiline input with Shift+Enter.
Missing features:
1. Scrollback.
2. Input history on up/down.
Open with backtick, close with Esc.