Skip to content

Commit 69749f5

Browse files
authored
fix custom_func section in programmability (#136)
1 parent ddd52b9 commit 69749f5

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

doc/programmability.md

+7-4
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ supported built-in `custom_func`s are listed [here](./customfuncs.md).
4444

4545
## Add A New `custom_func`
4646

47-
If the built-in `custom_func`s are enough, you can add your own custom functions by
47+
If the built-in `custom_func`s aren't enough, you can add your own custom functions by
4848
[doing this](../extensions/omniv21/samples/customfileformats/jsonlog/sample_test.go) (note the linked
4949
sample does more than just adding a new `custom_func`):
5050
```
@@ -72,9 +72,12 @@ for {
7272
}
7373
```
7474

75-
Each `custom_func` must be a Golang function with the first param being `*transformctx.Ctx`. The rest
76-
params can be of any type, as long as they will match the types of data that are fed into the function
77-
in `transform_declarations`.
75+
Each `custom_func` must be a Golang function with the first param being `*transformctx.Ctx`. There can be
76+
an optional second param of `*idr.Node` type (like in this
77+
[sample](../extensions/omniv21/samples/customfuncs/sample_test.go)). If omniparser detects a `custom_func`
78+
second param is of `*idr.Node` type, then the current contextual IDR node will be passed into the function
79+
automatically. The rest params can be of any type, as long as they will match the types of data that are
80+
fed into the function in `transform_declarations`.
7881

7982
## Add A New File Format
8083

0 commit comments

Comments
 (0)