You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ki...@apache.org on 2016/10/14 01:59:10 UTC
[trafficserver] 02/02: change to ts.process.uuid() and add error
handling for it
This is an automated email from the ASF dual-hosted git repository.
kichan pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git
commit b3296842207bcf5661bd6027ce0218f158636a35
Author: Kit Chan <ki...@apache.org>
AuthorDate: Wed Oct 12 23:18:36 2016 -0700
change to ts.process.uuid() and add error handling for it
---
doc/admin-guide/plugins/ts_lua.en.rst | 8 ++++----
plugins/experimental/ts_lua/ts_lua_misc.c | 10 +++++++---
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/doc/admin-guide/plugins/ts_lua.en.rst b/doc/admin-guide/plugins/ts_lua.en.rst
index 9794ffc..a5dc6e5 100644
--- a/doc/admin-guide/plugins/ts_lua.en.rst
+++ b/doc/admin-guide/plugins/ts_lua.en.rst
@@ -131,9 +131,9 @@ is always available within lua script. This package can be introduced into Lua l
`TOP <#ts-lua-plugin>`_
-ts.process_id
--------------
-**syntax:** *val = ts.process_id()*
+ts.process.uuid
+---------------
+**syntax:** *val = ts.process.uuid()*
**context:** global
@@ -143,7 +143,7 @@ Here is an example:
::
- local pid = ts.process_id() -- a436bae6-082c-4805-86af-78a5916c4a91
+ local pid = ts.process.uuid() -- a436bae6-082c-4805-86af-78a5916c4a91
`TOP <#ts-lua-plugin>`_
diff --git a/plugins/experimental/ts_lua/ts_lua_misc.c b/plugins/experimental/ts_lua/ts_lua_misc.c
index e82e1ca..51e6ac5 100644
--- a/plugins/experimental/ts_lua/ts_lua_misc.c
+++ b/plugins/experimental/ts_lua/ts_lua_misc.c
@@ -34,9 +34,13 @@ static void ts_lua_inject_misc_variables(lua_State *L);
void
ts_lua_inject_misc_api(lua_State *L)
{
- /* ts.process_id() */
+ lua_newtable(L);
+
+ /* ts.process.uuid() */
lua_pushcfunction(L, ts_lua_get_process_id);
- lua_setfield(L, -2, "process_id");
+ lua_setfield(L, -2, "uuid");
+
+ lua_setfield(L, -2, "process");
/* ts.now() */
lua_pushcfunction(L, ts_lua_get_now_time);
@@ -78,7 +82,7 @@ ts_lua_get_process_id(lua_State *L)
if (process) {
s = TSUuidStringGet(process);
} else {
- s = "";
+ return luaL_error(L, "not able to get process uuid");
}
lua_pushstring(L, s);
return 1;
--
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>.