[sr-dev] Patch allowing app_lua lua_run to return values

Nathan Angelacos nangelacos at genericconf.com
Thu Aug 25 21:31:02 CEST 2011


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");
}



-------------- next part --------------
A non-text attachment was scrubbed...
Name: lua_run-retcode.patch
Type: text/x-patch
Size: 1640 bytes
Desc: not available
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20110825/8dfc0c2c/attachment-0001.bin>


More information about the sr-dev mailing list