Skip to content

Commit

Permalink
Merge pull request #25 from pallene-lang/supply-traceback-fn
Browse files Browse the repository at this point in the history
Supply Pallene Tracer Error Handler Function to Use against `xpcall()`
  • Loading branch information
singul4ri7y committed Aug 22, 2024
2 parents 9c3758b + b6c221d commit 9aa8606
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pt-lua.c
Original file line number Diff line number Diff line change
Expand Up @@ -983,6 +983,11 @@ int main (int argc, char **argv) {
/* -------- PALLENE TRACER CODE -------- */
(void) pallene_tracer_init(L); /* initialize pallene tracer */
lua_pop(L, 1); /* We do not need the finalizer object here */

/* supply the message handler function with custom tracebacks. */
/* it is safe to set globals at this point, because no code has been run yet. */
lua_pushcfunction(L, msghandler);
lua_setglobal(L, "pallene_tracer_errhandler");
/* -------- PALLENE TRACER CODE END -------- */

lua_pushcfunction(L, &pmain); /* to call 'pmain' in protected mode */
Expand Down

0 comments on commit 9aa8606

Please sign in to comment.