What version of GopherLua are you using? :
github.com/yuin/gopher-lua v0.0.0-20200603152657-dc2b0ca8b37e
github.com/cjoudrey/gluahttp v0.0.0-20190104103309-101c19a37344
What version of Go are you using? :
go1.13.12
What operating system and processor architecture are you using? :
cross compile on win10/amd64(gomobile bind -o ./xxx.aar -ldflags "-s -w" -target=android)
run on android arm64
go code:
L := lua.NewState()
defer L.Close()
L.PreloadModule("http", gluahttp.NewHttpModule(&http.Client{}).Loader)
if err := L.DoString(script); err != nil {
log.Printf("runLua err:%v\n", err)
return
}
lua script:
local http = require("http")
response, error = http.request("post", "http://192.168.10.180:8086/test")
run on android got:
2020-09-05 03:54:24.675 20076-20299/org.xxx.messenger I/GoLog: runLua err:<string>:7: module http not found:
no field package.preload['http']
stat ./http.lua: no such file or directory
stat /usr/local/share/lua/5.1/http.lua: no such file or directory
stat /usr/local/share/lua/5.1/http/init.lua: no such file or directory,
stack traceback:
[G]: in function 'require'
<string>:7: in main chunk
[G]: ?
on iOS is ok (gomobile bind -ldflags "-s -w" -o=./xxx.framework -target=ios)
go code:
lua script:
run on android got:
on iOS is ok (gomobile bind -ldflags "-s -w" -o=./xxx.framework -target=ios)