Enclosed is a small patch that allows lua_run() to return an integer value. If the return value is not an integer, 1 is returned (like is true with current git master.) As a side effect, lua scripts can now exit() the sip-router script by returning 0.
Example:
Lua script: test_equality = function ( a , b ) if a == b then return 1 else return -1 end
sip-router script:
if (lua_run("test_equality", "$fU", "$tU")) { xdbg("SCRIPT: The values are equal\n"); }
Hi Nathan,
thanks for the patch. It will get in, but not sure yet if for 3.2.0, we are in testing phase. The patch is not that big, I will evaluate and see if there is any major impact. Ultimately it will be in next version.
Daniel
On 8/25/11 9:31 PM, Nathan Angelacos wrote:
Enclosed is a small patch that allows lua_run() to return an integer value. If the return value is not an integer, 1 is returned (like is true with current git master.) As a side effect, lua scripts can now exit() the sip-router script by returning 0.
Example:
Lua script: test_equality = function ( a , b ) if a == b then return 1 else return -1 end
sip-router script:
if (lua_run("test_equality", "$fU", "$tU")) { xdbg("SCRIPT: The values are equal\n"); }
sr-dev mailing list sr-dev@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
Thanks Daniel,
thanks for the patch. It will get in, but not sure yet if for 3.2.0, we are in testing phase. The patch is not that big, I will evaluate and see if there is any major impact. Ultimately it will be in next version.
Daniel
Sorry, should have been more clear.
I'm aware of the feature freeze, but decided "always returning true" was a bug, not a new feature.
Either way you decide is fine.