lua_function= in SUF now has limited support for non-global functions

To be precise, the string is considered as a dot-separated list of components.
This commit is contained in:
Celtic Minstrel 2016-03-31 02:12:53 -04:00
parent 4c45683d4d
commit fb6031d6a1
2 changed files with 4 additions and 1 deletions

View file

@ -21,6 +21,8 @@ Version 1.13.4+dev:
* Weapon filters now support number, parry, accuracy, and movement_used
* New [has_attack] in standard unit filters; supercedes has_weapon= and
uses full weapon filter.
* lua_function=var.member now works in SUF; however, 'var' still needs to
be a global variable.
* AiWML:
* Simplified aspect syntax which works for all aspects, present and future:
* All aspects with simple values can be specified as key=value

View file

@ -4896,7 +4896,8 @@ bool game_lua_kernel::run_filter(char const *name, unit const &u)
if (!ui.valid()) return false;
// Get the user filter by name.
if(!luaW_getglobal(L, name))
const std::vector<std::string>& path = utils::split(name, '.', utils::STRIP_SPACES);
if(!luaW_getglobal(L, path))
{
std::string message = std::string() + "function " + name + " not found";
log_error(message.c_str(), "Lua SUF Error");