[SR-Users] app_lua and lua_run parameter count

Daniel-Constantin Mierla miconda at gmail.com
Mon Aug 13 13:27:01 CEST 2018


there can be Lua function name plus up to 3 parameters, so over all, max
4 parameters to lua_run(...). The parameters must be given as string. An
example with max number of params:

lua_run("lua_funcx3", "$rU", "2", "$si");


On 13.08.18 12:50, Asgaroth wrote:
> Hi All,
> Quick question with regards the lua_run function in app_lua module.
> The documentation for v5.0.x states:
> "Execute the Lua function 'func' giving params as parameters. There
> can be up to 3 string parameters. The function must exist in the
> script loaded at startup via parameter 'load'. Parameters can be
> strings with pseudo-variables that are evaluated at runtime."
> Does this mean that lua_run can only have 3 parameters, or, does it
> mean that the function within the lua script can have up to 3 parameters?
> I have a function within lua that currently needs 3 parameters, so I'm
> hoping I can do the following:
> lua_run("some_function", "param_1", "param_2", "param_3")
> However, I'm not sure, from the documentation, if I can do this.
> On a side note, but related, can I pass defined variables/constants as
> parameters to lua_run too, for example, something like:
> #!define VAR_1 1234
> #!define VAR_2 hello
> lua_run("some_function", "$rd", VAR_1, VAR_2)
> Some clarification would be greatly appreciated.
> Thanks for reading.
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio World Conference -- www.kamailioworld.com

More information about the sr-users mailing list