Skip to content

Commit

Permalink
lua_function= in SUF now has limited support for non-global functions
Browse files Browse the repository at this point in the history
To be precise, the string is considered as a dot-separated list of components.
  • Loading branch information
CelticMinstrel committed Mar 31, 2016
1 parent 4c45683 commit fb6031d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions changelog
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/scripting/game_lua_kernel.cpp
Expand Up @@ -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");
Expand Down

0 comments on commit fb6031d

Please sign in to comment.