github.com/arnodel/golua@v0.0.0-20230215163904-e0b5347eaaa1/lib/base/rawset.go (about) 1 package base 2 3 import ( 4 "errors" 5 6 rt "github.com/arnodel/golua/runtime" 7 ) 8 9 func rawset(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) { 10 if err := c.CheckNArgs(3); err != nil { 11 return nil, err 12 } 13 tbl, err := c.TableArg(0) 14 if err != nil { 15 return nil, err 16 } 17 key := c.Arg(1) 18 if key.IsNil() { 19 return nil, errors.New("#2 must not be nil") 20 } 21 if err := t.SetTableCheck(tbl, key, c.Arg(2)); err != nil { 22 return nil, err 23 } 24 return c.PushingNext1(t.Runtime, c.Arg(0)), nil 25 }