@@ -576,7 +576,6 @@ func newLState(options Options) *LState {
576576 wrapped : false ,
577577 uvcache : nil ,
578578 hasErrorFunc : false ,
579- mainLoop : mainLoop ,
580579 ctx : nil ,
581580 }
582581 if options .MinimizeStackMemory {
@@ -1051,9 +1050,9 @@ func (ls *LState) callR(nargs, nret, rbase int) {
10511050 if ls .G .MainThread == nil {
10521051 ls .G .MainThread = ls
10531052 ls .G .CurrentThread = ls
1054- ls . mainLoop (ls , nil )
1053+ mainLoop (ls , nil )
10551054 } else {
1056- ls . mainLoop (ls , ls .currentFrame )
1055+ mainLoop (ls , ls .currentFrame )
10571056 }
10581057 if nret != MultRet {
10591058 ls .reg .SetTop (rbase + nret )
@@ -1404,7 +1403,6 @@ func (ls *LState) NewThread() (*LState, context.CancelFunc) {
14041403 thread .Env = ls .Env
14051404 var f context.CancelFunc = nil
14061405 if ls .ctx != nil {
1407- thread .mainLoop = mainLoopWithContext
14081406 thread .ctx , f = context .WithCancel (ls .ctx )
14091407 thread .ctxCancelFn = f
14101408 }
@@ -2044,9 +2042,8 @@ func (ls *LState) SetMx(mx int) {
20442042 }()
20452043}
20462044
2047- // SetContext set a context ctx to this LState. The provided ctx must be non-nil.
2045+ // SetContext set a context ctx to this LState.
20482046func (ls * LState ) SetContext (ctx context.Context ) {
2049- ls .mainLoop = mainLoopWithContext
20502047 ls .ctx = ctx
20512048}
20522049
@@ -2058,7 +2055,6 @@ func (ls *LState) Context() context.Context {
20582055// RemoveContext removes the context associated with this LState and returns this context.
20592056func (ls * LState ) RemoveContext () context.Context {
20602057 oldctx := ls .ctx
2061- ls .mainLoop = mainLoop
20622058 ls .ctx = nil
20632059 return oldctx
20642060}
0 commit comments