Norbyte / ositools

Advanced scripting and mod support for Divinity Original Sin 2
MIT License
382 stars 30 forks source link

Warn when invoking an unregistered console command #132

Open PinewoodPip opened 1 year ago

PinewoodPip commented 1 year ago

This PR adjusts console commands to show a warning when invoking a command that hasn't been registered.

image

This makes it easier/faster to realize whether you've made a typo in a command, forgot to load the script it's in, are trying to run it in the wrong context, or ran into other shenanigans that might cause it to not run.

The loop has also been adjusted to use ipairs(); the order of pairs() is unspecified for numeric keys, though it does seem to work orderly in most cases.

Additionally, the i variable in the loop has been replaced with _ to silence an "unused variable" warning in the Sumneko lua extension.