You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by jp...@apache.org on 2012/06/12 17:51:36 UTC

[4/50] git commit: use library loader helper

use library loader helper


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/17132c97
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/17132c97
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/17132c97

Branch: refs/heads/jpeach/lua
Commit: 17132c9702fc8dcfa78e520edf693998ec1fcc5b
Parents: 2835d03
Author: James Peach <jp...@apache.org>
Authored: Tue Apr 24 22:17:50 2012 -0700
Committer: James Peach <jp...@apache.org>
Committed: Tue Jun 12 08:48:38 2012 -0700

----------------------------------------------------------------------
 plugins/lua/lua.cc |   20 ++------------------
 1 files changed, 2 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/17132c97/plugins/lua/lua.cc
----------------------------------------------------------------------
diff --git a/plugins/lua/lua.cc b/plugins/lua/lua.cc
index fb75848..5caa7f3 100644
--- a/plugins/lua/lua.cc
+++ b/plugins/lua/lua.cc
@@ -128,24 +128,8 @@ LuaPluginNewState(void)
     return NULL;
   }
 
-//  LuaLoadLibraries(lua);
-//  LuaRegisterLibrary(lua, "ts", LuaApiInit);
-
-  luaL_openlibs(lua);
-  // Pull up the preload table.
-  lua_getglobal(lua, "package");
-  lua_getfield(lua, -1, "preload");
-
-  // Pop the 'package' table.
-  lua_remove(lua, -2);
-
-  // Register LuaApiInit to load the 'ts' package.
-  lua_pushcfunction(lua, LuaApiInit);
-  lua_setfield(lua, -2, "ts");
-
-  // Pop the 'preload' table.
-  lua_pop(lua, -1);
-
+  LuaLoadLibraries(lua);
+  LuaRegisterLibrary(lua, "ts", LuaApiInit);
 
   return lua;
 }