mirror of
https://github.com/akyaiy/GoSally-mvp.git
synced 2026-01-03 08:52:24 +00:00
delete some io.* writing functions
This commit is contained in:
@@ -2,15 +2,3 @@
|
|||||||
package.path = package.path .. ";/usr/lib64/lua/5.1/?.lua;/usr/local/share/lua/5.1/?.lua" .. ";./com/?.lua;"
|
package.path = package.path .. ";/usr/lib64/lua/5.1/?.lua;/usr/local/share/lua/5.1/?.lua" .. ";./com/?.lua;"
|
||||||
package.cpath = package.cpath .. ";/usr/lib64/lua/5.1/?.so;/usr/local/lib/lua/5.1/?.so"
|
package.cpath = package.cpath .. ";/usr/lib64/lua/5.1/?.so;/usr/local/lib/lua/5.1/?.so"
|
||||||
|
|
||||||
print = function() end
|
|
||||||
io.write = function(...) end
|
|
||||||
io.stdout = function() return nil end
|
|
||||||
io.stderr = function() return nil end
|
|
||||||
io.read = function(...) return nil end
|
|
||||||
|
|
||||||
---@type table<string, any>
|
|
||||||
Status = {
|
|
||||||
ok = "ok",
|
|
||||||
error = "error",
|
|
||||||
invalid = "invalid",
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -46,6 +46,18 @@ func (h *HandlerV1) handleLUA(sid string, r *http.Request, req *rpc.RPCRequest,
|
|||||||
L := lua.NewState()
|
L := lua.NewState()
|
||||||
defer L.Close()
|
defer L.Close()
|
||||||
|
|
||||||
|
ioMod := L.GetGlobal("io").(*lua.LTable)
|
||||||
|
for _, k := range []string{"write", "output", "flush", "read", "input"} {
|
||||||
|
ioMod.RawSetString(k, lua.LNil)
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, name := range []string{"stdout", "stderr", "stdin"} {
|
||||||
|
stream := ioMod.RawGetString(name)
|
||||||
|
if t, ok := stream.(*lua.LUserData); ok {
|
||||||
|
t.Metatable = lua.LNil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
seed := rand.Int()
|
seed := rand.Int()
|
||||||
|
|
||||||
loadSessionMod := func(L *lua.LState) int {
|
loadSessionMod := func(L *lua.LState) int {
|
||||||
@@ -59,7 +71,7 @@ func (h *HandlerV1) handleLUA(sid string, r *http.Request, req *rpc.RPCRequest,
|
|||||||
for k, v := range r.Header {
|
for k, v := range r.Header {
|
||||||
L.SetField(fetchedHeadersTable, k, ConvertGolangTypesToLua(L, v))
|
L.SetField(fetchedHeadersTable, k, ConvertGolangTypesToLua(L, v))
|
||||||
}
|
}
|
||||||
|
|
||||||
headersGetter := L.NewFunction(func(L *lua.LState) int {
|
headersGetter := L.NewFunction(func(L *lua.LState) int {
|
||||||
path := L.OptString(1, "")
|
path := L.OptString(1, "")
|
||||||
def := L.Get(2)
|
def := L.Get(2)
|
||||||
|
|||||||
Reference in New Issue
Block a user