(f filters.FilterContext)
| 602 | } |
| 603 | |
| 604 | func getStateBag(f filters.FilterContext) func(*lua.LState) int { |
| 605 | return func(s *lua.LState) int { |
| 606 | fld := s.ToString(-1) |
| 607 | res, ok := f.StateBag()[fld] |
| 608 | if !ok { |
| 609 | return 0 |
| 610 | } |
| 611 | switch res := res.(type) { |
| 612 | case string: |
| 613 | s.Push(lua.LString(res)) |
| 614 | case int: |
| 615 | s.Push(lua.LNumber(res)) |
| 616 | case int64: |
| 617 | s.Push(lua.LNumber(res)) |
| 618 | case float64: |
| 619 | s.Push(lua.LNumber(res)) |
| 620 | case *lua.LTable: |
| 621 | s.Push(res) // load *lua.LTable as is |
| 622 | default: |
| 623 | return 0 |
| 624 | } |
| 625 | return 1 |
| 626 | } |
| 627 | } |
| 628 | |
| 629 | func setStateBag(f filters.FilterContext) func(*lua.LState) int { |
| 630 | return func(s *lua.LState) int { |
no test coverage detected
searching dependent graphs…