Comments (1)
Unit test:
func Test_loop_close(t *testing.T) {
var s1 = `
function f()
while true do
print("Hello World")
end
end
f()
`
var luaVM = lua.NewState()
go func() {
err1 := luaVM.DoString(s1)
if err1 != nil {
panic(err1)
}
}()
time.Sleep(3 * time.Second)
luaVM.Close()
}
Panic log:
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x50 pc=0xb1a892]
goroutine 16 [running]:
github.com/yuin/gopher-lua.(*LState).PCall.func1()
C:/Users/admin/go/pkg/mod/github.com/yuin/[email protected]/state.go:2020 +0x532
panic({0x1608280, 0x145c120})
C:/Program Files/Go/src/runtime/panic.go:884 +0x213
github.com/yuin/gopher-lua.callGFunction(0xc0000ad6b0, 0x0)
C:/Users/admin/go/pkg/mod/github.com/yuin/[email protected]/vm.go:262 +0x2f9
github.com/yuin/gopher-lua.init.3.func26(0xc0000ad6b0, 0x18000000?, 0xc000681000?)
C:/Users/admin/go/pkg/mod/github.com/yuin/[email protected]/vm.go:821 +0x379
github.com/yuin/gopher-lua.mainLoop(0xc0000ad6b0, 0xc0000ec600?)
C:/Users/admin/go/pkg/mod/github.com/yuin/[email protected]/vm.go:31 +0xfa
github.com/yuin/gopher-lua.(*LState).callR(0xc0000ad6b0, 0x0, 0xffffffffffffffff, 0xc000117f38?)
C:/Users/admin/go/pkg/mod/github.com/yuin/[email protected]/state.go:1211 +0x1b4
github.com/yuin/gopher-lua.(*LState).Call(...)
C:/Users/admin/go/pkg/mod/github.com/yuin/[email protected]/state.go:1967
github.com/yuin/gopher-lua.(*LState).PCall(0xc0000ad6b0, 0x0, 0xc0000ec600?, 0x0)
C:/Users/admin/go/pkg/mod/github.com/yuin/[email protected]/state.go:2030 +0x145
github.com/yuin/gopher-lua.(*LState).DoString(0xc0000ad6b0, {0x18c04d2?, 0x0?})
C:/Users/admin/go/pkg/mod/github.com/yuin/[email protected]/auxlib.go:405 +0x6b
github.com/i4de/rulex/test.Test_loop_close.func1()
C:/Users/admin/workspace/rulex/test/calllua_test.go:172 +0x25
created by github.com/i4de/rulex/test.Test_loop_close
C:/Users/admin/workspace/rulex/test/calllua_test.go:171 +0x7d
FAIL github.com/i4de/rulex/test 3.260s
FAIL
from go-lua.
Related Issues (20)
- How to add luasql module?
- can not use State.Next() func read lua array
- Port to arm64? HOT 2
- Status of this project? HOT 1
- bad argument #2 to '__newindex' (not a number in proper range)
- Description Lua table was misjudged as function
- Author ? I want to know go-lua how to support lua-socket?? HOT 1
- Call LUA function from GO HOT 10
- @blittle If I use a proxy, how do I solve the problem of cart data interoperability between the online store and the hydrogen channel? HOT 1
- Global Variable of type Lua Table HOT 1
- Are not C modules supported by go-lua?
- how to exit doFile HOT 1
- os.time() wrong implementation, time.Date in golang not the same with mktime
- os.date = nil HOT 1
- io.write discards spaces after trailing numbers
- conversion type not yet supported: c HOT 1
- How to deal with Lua infinite loop? HOT 1
- How to call go function on lua scripts? HOT 2
- closed
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-lua.