summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjussi2023-05-01 18:57:39 +0300
committerjussi2023-05-01 18:57:39 +0300
commitf7a42189f054c8d81c24c8ea395d0818bb524c61 (patch)
treecb39bfc77bcf33e11b8b912fd6d9c8caf03300ae
parentacc56fc7c2bedde6eced005eab0a37b6281b9a23 (diff)
downloadreilua-enhanced-f7a42189f054c8d81c24c8ea395d0818bb524c61.tar.gz
reilua-enhanced-f7a42189f054c8d81c24c8ea395d0818bb524c61.tar.bz2
reilua-enhanced-f7a42189f054c8d81c24c8ea395d0818bb524c61.zip
Tracelog call fix.
-rw-r--r--src/lua_core.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/lua_core.c b/src/lua_core.c
index 020f3e5..af9b6eb 100644
--- a/src/lua_core.c
+++ b/src/lua_core.c
@@ -528,7 +528,8 @@ void LogCustom( int logLevel, const char *text, va_list args ) {
lua_pushcfunction( L, luaTraceback );
int tracebackidx = lua_gettop( L );
- lua_getglobal( L, "log" );
+ lua_getglobal( L, "RL" );
+ lua_getfield( L, -1, "log" );
if ( lua_isfunction( L, -1 ) ) {
lua_pushinteger( L, logLevel );
@@ -600,7 +601,6 @@ bool luaCallMain() {
sprintf( path, "%smain", state->exePath );
}
#endif
-
luaL_dofile( L, path );
/* Check errors in main.lua */
@@ -611,7 +611,9 @@ bool luaCallMain() {
lua_pushcfunction( L, luaTraceback );
int tracebackidx = lua_gettop( L );
- // lua_getglobal( L, "init" );
+ /* Apply custom callback here. */
+ SetTraceLogCallback( LogCustom );
+
lua_getglobal( L, "RL" );
lua_getfield ( L, -1, "init" );
@@ -627,8 +629,6 @@ bool luaCallMain() {
return false;
}
lua_pop( L, -1 );
- /* Apply custom callback here. */
- SetTraceLogCallback( LogCustom );
return true;
}
@@ -639,7 +639,6 @@ void luaCallProcess() {
lua_pushcfunction( L, luaTraceback );
int tracebackidx = lua_gettop(L);
- // lua_getglobal( L, "process" );
lua_getglobal( L, "RL" );
lua_getfield ( L, -1, "process" );
@@ -661,7 +660,6 @@ void luaCallDraw() {
lua_pushcfunction( L, luaTraceback );
int tracebackidx = lua_gettop(L);
- // lua_getglobal( L, "draw" );
lua_getglobal( L, "RL" );
lua_getfield ( L, -1, "draw" );
@@ -684,7 +682,6 @@ void luaCallExit() {
lua_pushcfunction( L, luaTraceback );
int tracebackidx = lua_gettop(L);
- // lua_getglobal( L, "exit" );
lua_getglobal( L, "RL" );
lua_getfield ( L, -1, "exit" );