Unverified Commit 682fb038 authored by Simon Esposito's avatar Simon Esposito Committed by GitHub
Browse files

Upgrade gopher-lua to latest (#604)

Include commit that fixes Nil reg entry panic.
parent 32f03e3a
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -936,18 +936,22 @@ func (ls *LState) initCallFrame(cf *callFrame) { // +inline-start
		proto := cf.Fn.Proto
		nargs := cf.NArgs
		np := int(proto.NumParameters)
		if nargs < np {
			// default any missing arguments to nil
			newSize := cf.LocalBase + np
			// +inline-call ls.reg.checkSize newSize
			for i := nargs; i < np; i++ {
				ls.reg.array[cf.LocalBase+i] = LNil
			}
			nargs = np
			ls.reg.top = newSize
		}

		if (proto.IsVarArg & VarArgIsVarArg) == 0 {
			if nargs < int(proto.NumUsedRegisters) {
				nargs = int(proto.NumUsedRegisters)
			}
			newSize = cf.LocalBase + nargs
			newSize := cf.LocalBase + nargs
			// +inline-call ls.reg.checkSize newSize
			for i := np; i < nargs; i++ {
				ls.reg.array[cf.LocalBase+i] = LNil
+2 −1
Original line number Diff line number Diff line
@@ -2,9 +2,10 @@ package lua

import (
	"fmt"
	"github.com/heroiclabs/nakama/v3/internal/gopher-lua/ast"
	"math"
	"reflect"

	"github.com/heroiclabs/nakama/v3/internal/gopher-lua/ast"
)

/* internal constants & structs  {{{ */
+2 −1
Original line number Diff line number Diff line
@@ -4,11 +4,12 @@ import (
	"bufio"
	"bytes"
	"fmt"
	"github.com/heroiclabs/nakama/v3/internal/gopher-lua/ast"
	"io"
	"reflect"
	"strconv"
	"strings"

	"github.com/heroiclabs/nakama/v3/internal/gopher-lua/ast"
)

const EOF = -1
+2 −1
Original line number Diff line number Diff line
@@ -2,12 +2,13 @@ package lua

import (
	"fmt"
	"github.com/heroiclabs/nakama/v3/internal/gopher-lua/parse"
	"os"
	"runtime"
	"sync/atomic"
	"testing"
	"time"

	"github.com/heroiclabs/nakama/v3/internal/gopher-lua/parse"
)

const maxMemory = 40
+32 −24
Original line number Diff line number Diff line
@@ -982,6 +982,8 @@ func (ls *LState) initCallFrame(cf *callFrame) { // +inline-start
		proto := cf.Fn.Proto
		nargs := cf.NArgs
		np := int(proto.NumParameters)
		if nargs < np {
			// default any missing arguments to nil
			newSize := cf.LocalBase + np
			// this section is inlined by go-inline
			// source function is 'func (rg *registry) checkSize(requiredSize int) ' in '_state.go'
@@ -994,14 +996,16 @@ func (ls *LState) initCallFrame(cf *callFrame) { // +inline-start
			}
			for i := nargs; i < np; i++ {
				ls.reg.array[cf.LocalBase+i] = LNil
			}
			nargs = np
			ls.reg.top = newSize
		}

		if (proto.IsVarArg & VarArgIsVarArg) == 0 {
			if nargs < int(proto.NumUsedRegisters) {
				nargs = int(proto.NumUsedRegisters)
			}
			newSize = cf.LocalBase + nargs
			newSize := cf.LocalBase + nargs
			// this section is inlined by go-inline
			// source function is 'func (rg *registry) checkSize(requiredSize int) ' in '_state.go'
			{
@@ -1090,6 +1094,8 @@ func (ls *LState) pushCallFrame(cf callFrame, fn LValue, meta bool) { // +inline
			proto := cf.Fn.Proto
			nargs := cf.NArgs
			np := int(proto.NumParameters)
			if nargs < np {
				// default any missing arguments to nil
				newSize := cf.LocalBase + np
				// this section is inlined by go-inline
				// source function is 'func (rg *registry) checkSize(requiredSize int) ' in '_state.go'
@@ -1102,14 +1108,16 @@ func (ls *LState) pushCallFrame(cf callFrame, fn LValue, meta bool) { // +inline
				}
				for i := nargs; i < np; i++ {
					ls.reg.array[cf.LocalBase+i] = LNil
				}
				nargs = np
				ls.reg.top = newSize
			}

			if (proto.IsVarArg & VarArgIsVarArg) == 0 {
				if nargs < int(proto.NumUsedRegisters) {
					nargs = int(proto.NumUsedRegisters)
				}
				newSize = cf.LocalBase + nargs
				newSize := cf.LocalBase + nargs
				// this section is inlined by go-inline
				// source function is 'func (rg *registry) checkSize(requiredSize int) ' in '_state.go'
				{
Loading