mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
lua write error
This commit is contained in:
4
Logs.cpp
4
Logs.cpp
@@ -70,7 +70,7 @@ std::string filename_scenery() {
|
||||
void WriteLog( const char *str, logtype const Type ) {
|
||||
|
||||
if( str == nullptr ) { return; }
|
||||
if( true == TestFlag( Global.DisabledLogTypes, Type ) ) { return; }
|
||||
if( true == TestFlag( Global.DisabledLogTypes, (int)Type ) ) { return; }
|
||||
|
||||
if (Global.iWriteLogEnabled & 1) {
|
||||
if( !output.is_open() ) {
|
||||
@@ -106,7 +106,7 @@ void WriteLog( const char *str, logtype const Type ) {
|
||||
void ErrorLog( const char *str, logtype const Type ) {
|
||||
|
||||
if( str == nullptr ) { return; }
|
||||
if( true == TestFlag( Global.DisabledLogTypes, Type ) ) { return; }
|
||||
if( true == TestFlag( Global.DisabledLogTypes, (int)Type ) ) { return; }
|
||||
|
||||
if (!errors.is_open()) {
|
||||
|
||||
|
||||
5
Logs.h
5
Logs.h
@@ -11,12 +11,13 @@ http://mozilla.org/MPL/2.0/.
|
||||
|
||||
#include "uilayer.h"
|
||||
|
||||
enum logtype : unsigned int {
|
||||
enum class logtype : unsigned int {
|
||||
|
||||
generic = ( 1 << 0 ),
|
||||
file = ( 1 << 1 ),
|
||||
model = ( 1 << 2 ),
|
||||
texture = ( 1 << 3 )
|
||||
texture = ( 1 << 3 ),
|
||||
lua = ( 1 << 4 )
|
||||
};
|
||||
|
||||
void WriteLog( const char *str, logtype const Type = logtype::generic );
|
||||
|
||||
7
lua.cpp
7
lua.cpp
@@ -158,7 +158,12 @@ extern "C"
|
||||
|
||||
EXPORT void scriptapi_writelog(const char* txt)
|
||||
{
|
||||
WriteLog("lua: log: " + std::string(txt));
|
||||
WriteLog("lua: log: " + std::string(txt), logtype::lua);
|
||||
}
|
||||
|
||||
EXPORT void scriptapi_writeerrorlog(const char* txt)
|
||||
{
|
||||
ErrorLog("lua: log: " + std::string(txt), logtype::lua);
|
||||
}
|
||||
|
||||
struct memcell_values { const char *str; double num1; double num2; };
|
||||
|
||||
@@ -29,6 +29,7 @@ const char lua_ffi[] = "local ffi = require(\"ffi\")\n"
|
||||
"\n"
|
||||
"double scriptapi_random(double a, double b);\n"
|
||||
"void scriptapi_writelog(const char* txt);\n"
|
||||
"void scriptapi_writeerrorlog(const char* txt);\n"
|
||||
"]]\n"
|
||||
"\n"
|
||||
"local ns = ffi.C\n"
|
||||
@@ -88,4 +89,5 @@ const char lua_ffi[] = "local ffi = require(\"ffi\")\n"
|
||||
"\n"
|
||||
"module.random = ns.scriptapi_random\n"
|
||||
"module.writelog = ns.scriptapi_writelog\n"
|
||||
"module.writeerrorlog = ns.scriptapi_writeerrorlog\n"
|
||||
"\nreturn module\n";
|
||||
|
||||
Reference in New Issue
Block a user