* }}} */ * table operations {{{ */
(obj *LTable, n string, size int)
| 262 | /* table operations {{{ */ |
| 263 | |
| 264 | func (ls *LState) FindTable(obj *LTable, n string, size int) LValue { |
| 265 | names := strings.Split(n, ".") |
| 266 | curobj := obj |
| 267 | for _, name := range names { |
| 268 | if curobj.Type() != LTTable { |
| 269 | return LNil |
| 270 | } |
| 271 | nextobj := ls.RawGet(curobj, LString(name)) |
| 272 | if nextobj == LNil { |
| 273 | tb := ls.CreateTable(0, size) |
| 274 | ls.RawSet(curobj, LString(name), tb) |
| 275 | curobj = tb |
| 276 | } else if nextobj.Type() != LTTable { |
| 277 | return LNil |
| 278 | } else { |
| 279 | curobj = nextobj.(*LTable) |
| 280 | } |
| 281 | } |
| 282 | return curobj |
| 283 | } |
| 284 | |
| 285 | /* }}} */ |
| 286 |
no test coverage detected