NewLuaScriptWithOptions creates a new filter spec with options
(opts LuaOptions)
| 64 | |
| 65 | // NewLuaScriptWithOptions creates a new filter spec with options |
| 66 | func NewLuaScriptWithOptions(opts LuaOptions) (filters.Spec, error) { |
| 67 | sources := opts.Sources |
| 68 | if len(sources) == 0 { |
| 69 | // backwards compatible default, allow all |
| 70 | sources = append(sources, "file", "inline") |
| 71 | } else if contains("none", opts.Sources) { |
| 72 | sources = nil |
| 73 | } |
| 74 | return &luaScript{ |
| 75 | modules: opts.Modules, |
| 76 | sources: sources, |
| 77 | }, nil |
| 78 | } |
| 79 | |
| 80 | // Name returns the name of the filter ("lua") |
| 81 | func (ls *luaScript) Name() string { |