Skip to content

Commit

Permalink
Do not lua_next on userdata.
Browse files Browse the repository at this point in the history
Ever.
Really.
YOU HAVE BEEN WARNED!

Closes #2171
  • Loading branch information
GregoryLundberg committed Nov 30, 2017
1 parent 880ef2c commit caeff10
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/scripting/lua_kernel_base.cpp
Expand Up @@ -910,6 +910,10 @@ std::vector<std::string> lua_kernel_base::get_attribute_names(const std::string
lua_pushlstring(L, partial_name.c_str(), partial_name.size());
luaW_pcall(L, 2, 1);
ret = lua_check<std::vector<std::string>>(L, -1);
} else if(lua_type(L, -1) != LUA_TTABLE) {
LOG_LUA << "Userdata missing __tab_enum meta-function for tab completion";
lua_settop(L, save_stack);
return ret;
} else {
lua_settop(L, top);
// Metafunction not found, so use lua_next to enumerate the table
Expand Down

0 comments on commit caeff10

Please sign in to comment.