[wesnoth-commits] [wesnoth/wesnoth] 30e509: Add a dir() function to improve API discoverability
Celtic Minstrel
noreply at github.com
Fri Jul 2 18:50:13 UTC 2021
Branch: refs/heads/lua_dir
Home: https://github.com/wesnoth/wesnoth
Commit: 30e509b323ceae0d8015b2d7dd276694b4ba3d92
https://github.com/wesnoth/wesnoth/commit/30e509b323ceae0d8015b2d7dd276694b4ba3d92
Author: Celtic Minstrel <celtic.minstrel.ca at some.place>
Date: 2021-07-02 (Fri, 02 Jul 2021)
Changed paths:
M src/scripting/lua_kernel_base.cpp
Log Message:
-----------
Add a dir() function to improve API discoverability
The purpose is to simply list everything that's available in a given module or object.
Currently, it only works for tables. The plan is to extend it to userdata objects if and when it is approved.
Commit: 156b294dc697ffc1fc1d081947f624327a6ed4b6
https://github.com/wesnoth/wesnoth/commit/156b294dc697ffc1fc1d081947f624327a6ed4b6
Author: Celtic Minstrel <celtic.minstrel.ca at some.place>
Date: 2021-07-02 (Fri, 02 Jul 2021)
Changed paths:
M src/ai/lua/core.cpp
Log Message:
-----------
Lua: Refactor the AI module to be dir()-friendly
This places all read-only functions straight into the AI table, which means it sticks when stdlib.lua nulls out the old move map API.
The AI table then implements the __dir metamethod to add the mutating functions in if read_only is false.
This also adds a __dir metamethod for the aspects table which gets the list of aspects directly from the engine.
Compare: https://github.com/wesnoth/wesnoth/compare/f60167fab7bd...156b294dc697
More information about the Commits
mailing list