[SR-Users] app_lua and lua_run parameter count
00asgaroth00 at gmail.com
Mon Aug 13 13:35:54 CEST 2018
Excellent, thanks for clarification.
To pass #!defined vars i'd need to do something like:
lua_run("some_function", '"' + VAR_1 + '"')
seeing that they need to be quoted as strings, or, is it possible to
access #!define vars from directly within the lua function?
Another side question, is it possible to use htable from within lua, or
is it the pv module to access $sht (sr.pv.sht)?
On 13/08/18 12:27, Daniel-Constantin Mierla wrote:
> 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
More information about the sr-users