mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2025-07-01 23:35:41 +00:00
Lua: Add MP.PrintRaw
This commit is contained in:
parent
dd70e88e4c
commit
1ff5107707
@ -19,5 +19,6 @@ namespace MP {
|
|||||||
bool IsPlayerGuest(int ID);
|
bool IsPlayerGuest(int ID);
|
||||||
bool IsPlayerConnected(int ID);
|
bool IsPlayerConnected(int ID);
|
||||||
void Sleep(size_t Ms);
|
void Sleep(size_t Ms);
|
||||||
|
void PrintRaw(sol::variadic_args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -234,3 +234,12 @@ bool LuaAPI::MP::IsPlayerGuest(int ID) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LuaAPI::MP::PrintRaw(sol::variadic_args Args) {
|
||||||
|
std::string ToPrint = "";
|
||||||
|
for (const auto& Arg : Args) {
|
||||||
|
ToPrint += LuaToString(static_cast<const sol::object>(Arg));
|
||||||
|
ToPrint += "\t";
|
||||||
|
}
|
||||||
|
Application::Console().WriteRaw(ToPrint);
|
||||||
|
}
|
||||||
|
@ -9,13 +9,6 @@
|
|||||||
#include <random>
|
#include <random>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
|
|
||||||
static std::mt19937_64 MTGen64;
|
|
||||||
|
|
||||||
static TLuaStateId GenerateUniqueStateId() {
|
|
||||||
auto Time = std::chrono::high_resolution_clock::now().time_since_epoch();
|
|
||||||
return std::to_string(MTGen64()) + std::to_string(std::chrono::duration_cast<std::chrono::nanoseconds>(Time).count());
|
|
||||||
}
|
|
||||||
|
|
||||||
TLuaEngine* LuaAPI::MP::Engine;
|
TLuaEngine* LuaAPI::MP::Engine;
|
||||||
|
|
||||||
TLuaEngine::TLuaEngine() {
|
TLuaEngine::TLuaEngine() {
|
||||||
@ -327,6 +320,7 @@ TLuaEngine::StateThreadData::StateThreadData(const std::string& Name, std::atomi
|
|||||||
return Lua_GetPlayerIdentifiers(ID);
|
return Lua_GetPlayerIdentifiers(ID);
|
||||||
});
|
});
|
||||||
Table.set_function("Sleep", &LuaAPI::MP::Sleep);
|
Table.set_function("Sleep", &LuaAPI::MP::Sleep);
|
||||||
|
Table.set_function("PrintRaw", &LuaAPI::MP::PrintRaw);
|
||||||
Table.set_function("Set", &LuaAPI::MP::Set);
|
Table.set_function("Set", &LuaAPI::MP::Set);
|
||||||
Table.set_function("HttpsGET", [&](const std::string& Host, int Port, const std::string& Target) -> std::tuple<int, std::string> {
|
Table.set_function("HttpsGET", [&](const std::string& Host, int Port, const std::string& Target) -> std::tuple<int, std::string> {
|
||||||
unsigned Status;
|
unsigned Status;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user