lua: refactor to simplify state creation and pooled script execution

This commit is contained in:
Meo597
2026-10-03 21:57:54 +08:00
parent 5afe260f10
commit 2610e57ecf
9 changed files with 126 additions and 117 deletions
+2 -2
View File
@@ -121,9 +121,9 @@ func pushLuaError(L *lua.LState, err error) {
}
// CallLuaHook invokes HandleRoute in the supplied state.
func (r *Router) CallLuaHook(L *lua.LState, ctx context.Context, routeCtx routing.Context) (string, string, error) {
func (r *Router) CallLuaHook(L *lua.LState, luaCtx context.Context, routeCtx routing.Context) (string, string, error) {
previous, top := L.Context(), L.GetTop()
L.SetContext(ctx)
L.SetContext(luaCtx)
defer func() {
L.SetTop(top)
if previous == nil {