mirror of
https://github.com/akyaiy/GoSally-mvp.git
synced 2026-01-03 18:52:25 +00:00
make fields in configuration structures pointers, fix errors in code related to this change
This commit is contained in:
@@ -12,8 +12,6 @@ import (
|
||||
lua "github.com/yuin/gopher-lua"
|
||||
)
|
||||
|
||||
|
||||
|
||||
func (h *HandlerV1) handleLUA(path string, req *rpc.RPCRequest) *rpc.RPCResponse {
|
||||
L := lua.NewState()
|
||||
defer L.Close()
|
||||
@@ -36,10 +34,10 @@ func (h *HandlerV1) handleLUA(path string, req *rpc.RPCRequest) *rpc.RPCResponse
|
||||
logTable := L.NewTable()
|
||||
|
||||
logFuncs := map[string]func(string, ...any){
|
||||
"Info": h.x.SLog.Info,
|
||||
"Debug": h.x.SLog.Debug,
|
||||
"Error": h.x.SLog.Error,
|
||||
"Warn": h.x.SLog.Warn,
|
||||
"Info": h.x.SLog.Info,
|
||||
"Debug": h.x.SLog.Debug,
|
||||
"Error": h.x.SLog.Error,
|
||||
"Warn": h.x.SLog.Warn,
|
||||
}
|
||||
|
||||
for name, logFunc := range logFuncs {
|
||||
@@ -70,7 +68,7 @@ func (h *HandlerV1) handleLUA(path string, req *rpc.RPCRequest) *rpc.RPCResponse
|
||||
|
||||
L.SetGlobal("Log", logTable)
|
||||
|
||||
prep := filepath.Join(h.x.Config.Conf.ComDir, "_prepare.lua")
|
||||
prep := filepath.Join(*h.x.Config.Conf.ComDir, "_prepare.lua")
|
||||
if _, err := os.Stat(prep); err == nil {
|
||||
if err := L.DoFile(prep); err != nil {
|
||||
return rpc.NewError(rpc.ErrInternalError, err.Error(), req.ID)
|
||||
|
||||
Reference in New Issue
Block a user