add RunCommand()

This commit is contained in:
Axel Cocat
2021-06-21 15:59:44 +02:00
parent b62c606c9e
commit d533224895
3 changed files with 18 additions and 0 deletions

View File

@@ -1210,6 +1210,22 @@ namespace LuaGlobalFunctions
return 0;
}
/**
* Runs a command.
*
* @param string command : the command to run
*/
int RunCommand(lua_State* L)
{
const char* command = Eluna::CHECKVAL<const char*>(L, 1);
#if defined TRINITY || AZEROTHCORE
eWorld->QueueCliCommand(new CliCommandHolder(nullptr, command, nullptr, nullptr));
#elif defined MANGOS
eWorld->QueueCliCommand(new CliCommandHolder(0, SEC_CONSOLE, nullptr, command, nullptr, nullptr));
#endif
return 0;
}
/**
* Sends a message to all [Player]s online.
*