Skip to content

Commit

Permalink
ghoulsblade#23 Added cache functionality to replaced require func
Browse files Browse the repository at this point in the history
  • Loading branch information
MaddieM4 committed May 7, 2013
1 parent a214532 commit 65b85c4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ function LuaBootStrap () {
// replace default lua.js require
console.log("Replacing require")
Lua.inject(function (path) {
// Check cache first
var cached = Lua.cache("package.loaded['" + path + "']")[0];
if (cached) return [cached];

// builtin libs
if (path == "socket.http") { return LoveRequireSocketHTTP(); }

Expand Down

0 comments on commit 65b85c4

Please sign in to comment.