mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2026-04-04 06:46:23 +00:00
fix lua autocomplete crash when a table contains number keys
This commit is contained in:
@@ -298,6 +298,7 @@ void LuaAPI::MP::PrintRaw(sol::variadic_args Args) {
|
||||
}
|
||||
|
||||
int LuaAPI::PanicHandler(lua_State* State) {
|
||||
//FIXME: unsafe operation, can cause stack overflow
|
||||
beammp_lua_error("PANIC: " + sol::stack::get<std::string>(State, 1));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -253,11 +253,15 @@ std::vector<std::string> TLuaEngine::StateThreadData::GetStateTableKeys(const st
|
||||
} else if (i == keys.size() - 1) {
|
||||
if (obj.get_type() == sol::type::table) {
|
||||
for (const auto& [key, value] : obj.as<sol::table>()) {
|
||||
std::string s = key.as<std::string>();
|
||||
if (value.get_type() == sol::type::function) {
|
||||
s += "(";
|
||||
if (key.get_type() == sol::type::string) {
|
||||
std::string s = key.as<std::string>();
|
||||
|
||||
if (value.get_type() == sol::type::function) {
|
||||
s += "(";
|
||||
}
|
||||
|
||||
Result.push_back(s);
|
||||
}
|
||||
Result.push_back(s);
|
||||
}
|
||||
} else {
|
||||
Result = { obj.as<std::string>() };
|
||||
|
||||
Reference in New Issue
Block a user