Add our custom gsc funcs

This commit is contained in:
ineed bots
2023-09-15 18:08:23 -06:00
parent 2e50e3274d
commit 6b612395b5
3 changed files with 39 additions and 6 deletions

View File

@ -109,9 +109,17 @@ namespace gsc
functions.insert_or_assign(name, function);
}
const std::unordered_map<std::string, game::BuiltinFunction>& get()
game::BuiltinFunction get(const char** name, int* type)
{
return functions;
auto got = functions.find(*name);
if (got == functions.end())
{
return nullptr;
}
*type = 0;
return got->second;
}
}
@ -122,9 +130,17 @@ namespace gsc
methods.insert_or_assign(name, method);
}
const std::unordered_map<std::string, game::BuiltinMethod>& get()
game::BuiltinMethod get(const char** name, int* type)
{
return methods;
auto got = methods.find(*name);
if (got == methods.end())
{
return nullptr;
}
*type = 0;
return got->second;
}
}

View File

@ -5,12 +5,12 @@ namespace gsc
namespace function
{
void add(const std::string& name, const game::BuiltinFunction function);
const std::unordered_map<std::string, game::BuiltinFunction>& get();
game::BuiltinFunction get(const char** name, int* type);
}
namespace method
{
void add(const std::string& name, const game::BuiltinMethod method);
const std::unordered_map<std::string, game::BuiltinMethod>& get();
game::BuiltinMethod get(const char** name, int* type);
}
}