Skip to content

Dynamic strings

CVEDIA-RT allows using dynamic strings that are processed in realtime.

Were to use

Dynamic strings are available when defining paths for Output Handler entries (Will receive the data object written to the output sink).

They are also available in Lua, by using the api.utils.getDynamicString(str, obj) function.

How to use

A dynamic string can be used by defining { } tags, these can be:

  • System Tags : CVEDIA-RT Engine has default system tags that can be used through all the system, they start with sys.:

    • {sys.time}: Replaces the tag, in realtime, with the current time, in seconds. Ex: 2022-08-11_141409

      This tag can receive a time format argument, according to strftime, and, if nothing is provided, the default value is : %F_%H%M%S

      Ex: test_string_{sys.time %M%S} -> test_string_1235

    • {sys.count [label]}: Replaces the sys.count tag, in realtime, with an incremental counter, based on the given label. It will only increment every time the function is called with that label in sys.count. (The label can be empty) Ex: test_string_{sys.count tag1} -> test_string_1, test_string_2, ...

  • Dynamic object Tags : The system usually receives an object, in which it can find properties to update the string in realtime.


When using the Lua function we can do the following:

    local data = { name ="testname", data1 = 12334, data2 = { subnode = "nodedata_123"}}

    local test1 = api.utils.getDynamicString("test_string_{}", data)
    print(test1) -- Resulting string : test_string_testname

    local test2 = api.utils.getDynamicString("test_string_{obj.data1}", data)
    print(test2) -- Resulting string : test_string_12334

    local test3 = api.utils.getDynamicString("test_{}_{sys.time}", data)
    print(test3) -- Resulting string : test_testname_2022-08-11_141409

    local test4 = api.utils.getDynamicString("test_{}_{obj.data2.subnode}", data)
    print(test4) -- Resulting string : test_testname_nodedata_123

    local test5 = api.utils.getDynamicString("test_string_{sys.count tag1}_{sys.time %S}")
    print(test5) -- Resulting string : test_string_1_42