1#+begin_src prep
2#@ ```
3#@ printf "one\ntwo\nthree\n" > /tmp/list.txt
4#@ printf "1\n2\n3\n"         >> /tmp/list.txt
5#@ printf "1.0\n2.0\n3.0"     >> /tmp/list.txt
6#@ ```
7#+end_src
8#+begin_src cfengine3
9bundle agent example_readintlist
10# @brief Example showing function return types
11{
12  vars:
13      "my_list_of_integers"
14        ilist => readintlist( "/tmp/list.txt",     # File to read
15                              "^(\D+)|(\d+[^\n]+)", # Ignore any lines that are not integers
16                              "\n",                 # Split on newlines
17                              inf,                  # Maximum number of entries
18                              inf);                 # Maximum number of bytes to read
19
20  reports:
21      "my_list_of_integers includes '$(my_list_of_integers)'";
22}
23bundle agent __main__
24{
25  methods: "example_readintlist";
26}
27#+end_src
28#+begin_src example_output
29#@ ```
30#@ R: my_list_of_integers includes '1'
31#@ R: my_list_of_integers includes '2'
32#@ R: my_list_of_integers includes '3'
33#@ ```
34#+end_src
35