mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2026-02-16 10:41:01 +00:00
Add printRaw
Same as print() but does not prefix with time, date, filename, etc. Use with care.
This commit is contained in:
@@ -614,7 +614,7 @@ int lua_Set(lua_State* L) {
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
int lua_Print(lua_State* L) {
|
||||
int InternalLuaPrint(lua_State* L, bool pretty) {
|
||||
int Arg = lua_gettop(L);
|
||||
std::string to_print;
|
||||
for (int i = 1; i <= Arg; i++) {
|
||||
@@ -647,9 +647,19 @@ int lua_Print(lua_State* L) {
|
||||
to_print += "\t";
|
||||
}
|
||||
}
|
||||
luaprint(to_print);
|
||||
if (pretty) {
|
||||
luaprint(to_print);
|
||||
} else {
|
||||
Application::Console().WriteRaw(to_print);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
int lua_Print(lua_State* L) {
|
||||
return InternalLuaPrint(L, true);
|
||||
}
|
||||
int lua_PrintRaw(lua_State* L) {
|
||||
return InternalLuaPrint(L, false);
|
||||
}
|
||||
}
|
||||
|
||||
int lua_TempFix(lua_State* L) {
|
||||
@@ -931,6 +941,7 @@ void TLuaFile::Load() {
|
||||
LuaTable::End(mLuaState, "MP");
|
||||
|
||||
lua_register(mLuaState, "print", lua_Print);
|
||||
lua_register(mLuaState, "printRaw", lua_PrintRaw);
|
||||
lua_register(mLuaState, "exit", lua_ServerExit);
|
||||
if (!mConsole)
|
||||
Reload();
|
||||
|
||||
Reference in New Issue
Block a user