Module: sip-router Branch: master Commit: fa4ac6a32b746805434d51e4f8618aa9e771e5f0 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=fa4ac6a3...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: Fri Jan 29 18:42:10 2010 +0100
app_lua: added helper function to return bool
---
modules/app_lua/app_lua_api.c | 12 ++++++++++++ modules/app_lua/app_lua_api.h | 2 ++ 2 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/modules/app_lua/app_lua_api.c b/modules/app_lua/app_lua_api.c index 9ebb5a4..37724b1 100644 --- a/modules/app_lua/app_lua_api.c +++ b/modules/app_lua/app_lua_api.c @@ -233,6 +233,18 @@ int lua_sr_initialized(void) /** * */ +int app_lua_return_boolean(lua_State *L, int b) +{ + if(b==0) + lua_pushboolean(L, 0); + else + lua_pushboolean(L, 1); + return 1; +} + +/** + * + */ int app_lua_dostring(struct sip_msg *msg, char *script) { int ret; diff --git a/modules/app_lua/app_lua_api.h b/modules/app_lua/app_lua_api.h index 6375ece..ff6d0d2 100644 --- a/modules/app_lua/app_lua_api.h +++ b/modules/app_lua/app_lua_api.h @@ -53,5 +53,7 @@ int app_lua_dofile(struct sip_msg *msg, char *script); int app_lua_run(struct sip_msg *msg, char *func, char *p1, char *p2, char *p3);
+int app_lua_return_boolean(lua_State *L, int b); + #endif