From 8cb5255d946a4541baf3643b2a77b9e2de43ed67 Mon Sep 17 00:00:00 2001 From: Fan Yang Date: Mon, 5 Feb 2024 14:00:03 +0800 Subject: [PATCH] separated luawrapper directory --- luahandler.go | 3 ++- luaapi.go => luawrapper/luaapi.go | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) rename luaapi.go => luawrapper/luaapi.go (93%) diff --git a/luahandler.go b/luahandler.go index 81c0e36..f66753a 100644 --- a/luahandler.go +++ b/luahandler.go @@ -12,6 +12,7 @@ import ( "time" "github.com/aarzilli/golua/lua" + lw "github.com/missdeer/getnovel/luawrapper" "github.com/missdeer/golib/httputil" "gitlab.com/ambrevar/golua/unicode" ) @@ -124,7 +125,7 @@ func checkLuaFile(localDirPath string, fileName string) error { func (h *ExternalHandler) initLuaEnv() { h.l.OpenLibs() - registerLuaAPIs(h.l) + lw.RegisterLuaAPIs(h.l) unicode.GoLuaReplaceFuncs(h.l) diff --git a/luaapi.go b/luawrapper/luaapi.go similarity index 93% rename from luaapi.go rename to luawrapper/luaapi.go index 471f7eb..9477ff8 100644 --- a/luaapi.go +++ b/luawrapper/luaapi.go @@ -1,4 +1,4 @@ -package main +package luawrapper import ( "github.com/aarzilli/golua/lua" @@ -26,7 +26,7 @@ func DetectContentCharset(L *lua.State) int { return 1 } -func registerLuaAPIs(L *lua.State) { +func RegisterLuaAPIs(L *lua.State) { // add string.convert(from, to, str) method L.GetGlobal("string") L.PushGoFunction(ConvertEncoding)