Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
202 changes: 101 additions & 101 deletions _state.go

Large diffs are not rendered by default.

320 changes: 160 additions & 160 deletions _vm.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion auxlib.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ func (ls *LState) LoadFile(path string) (*LFunction, error) {
if c == byte('#') {
// Unix exec. file?
// skip first line
_, err, _ = readBufioLine(reader)
_, _, err = readBufioLine(reader)
if err != nil {
return nil, newApiErrorE(ApiErrorFile, err)
}
Expand Down
20 changes: 10 additions & 10 deletions baselib.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,12 @@ func baseGetFEnv(L *LState) int {
} else {
cf := L.currentFrame
for i := 0; i < level && cf != nil; i++ {
cf = cf.Parent
cf = cf.parent
}
if cf == nil || cf.Fn.IsG {
if cf == nil || cf.fn.IsG {
L.Push(L.G.Global)
} else {
L.Push(cf.Fn.Env)
L.Push(cf.fn.Env)
}
}
return 1
Expand Down Expand Up @@ -355,13 +355,13 @@ func baseSetFEnv(L *LState) int {

cf := L.currentFrame
for i := 0; i < level && cf != nil; i++ {
cf = cf.Parent
cf = cf.parent
}
if cf == nil || cf.Fn.IsG {
if cf == nil || cf.fn.IsG {
L.RaiseError("cannot change the environment of given object")
} else {
cf.Fn.Env = env
L.Push(cf.Fn)
cf.fn.Env = env
L.Push(cf.fn)
return 1
}
}
Expand Down Expand Up @@ -484,13 +484,13 @@ func loModule(L *LState) int {
L.SetField(tb, "_PACKAGE", LString(pname))
}

caller := L.currentFrame.Parent
caller := L.currentFrame.parent
if caller == nil {
L.RaiseError("no calling stack.")
} else if caller.Fn.IsG {
} else if caller.fn.IsG {
L.RaiseError("module() can not be called from GFunctions.")
}
L.SetFEnv(caller.Fn, tb)
L.SetFEnv(caller.fn, tb)

top := L.GetTop()
for i := 2; i <= top; i++ {
Expand Down
6 changes: 5 additions & 1 deletion channellib.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ func channelSelect(L *LState) int {
cases := make([]reflect.SelectCase, L.GetTop())
top := L.GetTop()
for i := 0; i < top; i++ {
cas := reflect.SelectCase{reflect.SelectSend, reflect.ValueOf(nil), reflect.ValueOf(nil)}
cas := reflect.SelectCase{
Dir: reflect.SelectSend,
Chan: reflect.ValueOf(nil),
Send: reflect.ValueOf(nil),
}
tbl := L.CheckTable(i + 1)
dir, ok1 := tbl.RawGetInt(1).(LString)
if !ok1 {
Expand Down
Loading