From 08e1de819f31ecbba9183403ddfb1307b608767e Mon Sep 17 00:00:00 2001 From: Erica Marigold Date: Sat, 26 Apr 2025 07:49:28 +0100 Subject: [PATCH] fix: luau does not export a `luaL_errorL`, write our own --- internal/clua.c | 5 ----- internal/lauxlib.go | 6 ++++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/internal/clua.c b/internal/clua.c index fa2eed4..a0a9d27 100644 --- a/internal/clua.c +++ b/internal/clua.c @@ -13,11 +13,6 @@ lua_State* clua_newstate(void* f, void* ud) return lua_newstate((lua_Alloc)f, ud); } -l_noret cluaL_errorL(lua_State* L, char* msg) -{ - luaL_errorL(L, msg); -} - void clua_pushcclosurek(lua_State* L, void* f, char* debugname, int nup, void* cont) { return lua_pushcclosurek(L, (lua_CFunction)f, debugname, nup, (lua_Continuation)cont); } diff --git a/internal/lauxlib.go b/internal/lauxlib.go index e971875..3696797 100644 --- a/internal/lauxlib.go +++ b/internal/lauxlib.go @@ -171,8 +171,10 @@ func LErrorL(L *LuaState, msg string) { cmsg := C.CString(msg) defer C.free(unsafe.Pointer(cmsg)) - C.cluaL_errorL(L, cmsg) - panic(msg) + PushString(L, msg) + Error(L) + + // TODO: do we panic on the go side? } func LCheckOption(L *LuaState, narg int32, def string, lst []string) int32 {