Skip to content

Commit

Permalink
Bump of golua version up to v1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
asdek committed Sep 21, 2021
1 parent 15d8180 commit 2c88c33
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ module github.com/vxcontrol/luar

go 1.13

require github.com/vxcontrol/golua v1.0.0
require github.com/vxcontrol/golua v1.1.0
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ github.com/modern-go/gls v0.0.0-20190610040709-84558782a674 h1:1n+vuTzNkmbDn73+c
github.com/modern-go/gls v0.0.0-20190610040709-84558782a674/go.mod h1:I8AX+yW//L8Hshx6+a1m3bYkwXkpsVjA2795vP4f4oQ=
github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/vxcontrol/golua v1.0.0 h1:EVv0odsxnHMXLyBP9h9tMvtM3tX2QRc43AMkkBcUwEo=
github.com/vxcontrol/golua v1.0.0/go.mod h1:2eE5/byEyZ2lpsCGtIuNqV7O5PiG9r+MIa747aMBZiI=
github.com/vxcontrol/golua v1.1.0 h1:0Toe564yyUJ9hD7wl4JB+hHQLtlT3fZAC3JP+NK/DAU=
github.com/vxcontrol/golua v1.1.0/go.mod h1:2eE5/byEyZ2lpsCGtIuNqV7O5PiG9r+MIa747aMBZiI=
github.com/vxcontrol/rmx v0.0.0-20210315190445-0c5e1f972da6 h1:a4ML+o1WlNw8gOGautso1TTfETirOsUNC0Xpr+yWQLo=
github.com/vxcontrol/rmx v0.0.0-20210315190445-0c5e1f972da6/go.mod h1:tWgKOCwhzgp7K6XMYelYlTqB/v4/VubHgr2WOmd3XFI=
9 changes: 7 additions & 2 deletions luar_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package luar

import (
"fmt"
"reflect"
"runtime"
"sort"
Expand Down Expand Up @@ -711,7 +712,7 @@ func TestLuaObjectMT(t *testing.T) {
// Note: we skip error checking.
v, _ := valueOfProxy(L, 1)
k := L.ToInteger(2)
L.PushString(string(v.Index(k).Int()))
L.PushString(fmt.Sprintf("%c", v.Index(k).Int()))
return 1
}

Expand Down Expand Up @@ -866,9 +867,13 @@ setmetatable(a, { __call = function(arg) a[1] = a[1] + arg end })

err = a.Call(nil)
wantErr := "[string \"...\"]:3: attempt to perform arithmetic on local 'arg' (a nil value)"
if err == nil || err.Error() != wantErr {
if err == nil {
t.Fatal("panic on lua Call must be catched")
}
if le, ok := err.(*lua.LuaError); !ok || le.Msg != wantErr {
t.Fatalf("got error %q, want %q", err, wantErr)
}

checkStack(t, L)
}

Expand Down
10 changes: 6 additions & 4 deletions proxymm.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,10 +331,12 @@ func proxy__eq(L *lua.State) int {
}

func proxy__gc(L *lua.State) int {
proxyId := *(*uintptr)(L.ToUserdata(1))
proxymu.Lock()
delete(proxyMap, proxyId)
proxymu.Unlock()
if ud := L.ToUserdata(1); ud != nil {
proxyId := *(*uintptr)(ud)
proxymu.Lock()
delete(proxyMap, proxyId)
proxymu.Unlock()
}
return 0
}

Expand Down

0 comments on commit 2c88c33

Please sign in to comment.