Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local hasloaded = false;
- local ty, p = type, pairs;
- local smt, gmt = setmetatable, getmetatable;
- local sfe, gte = setfenv, getfenv;
- local rs = rawset;
- function tCopy(t, lookup_table)
- if (t == nil) then return nil end
- local copy = {}
- smt(copy, gmt(t))
- for i,v in p(t) do
- if ( !ty(v) == "table" ) then
- copy[i] = v
- else
- lookup_table = lookup_table or {}
- lookup_table[t] = copy
- if lookup_table[v] then
- copy[i] = lookup_table[v] -- we already copied this table. reuse the copy.
- else
- copy[i] = tCopy(v,lookup_table) -- not yet copied. copy it.
- end
- end
- end
- return copy
- end
- local function LoadLuaFileProtected( lf )
- local ENV = {};
- local GLOBAL = tCopy( _G );
- // add detoured func like this
- // GLOBAL.func = oldfunc;
- setmetatable( ENV, { __index = GLOBAL } );
- local oldENV = gte( 0 );
- sfe( 0, ENV );
- LUA_LoadFile( lf );
- sfe( 0, oldENV );
- end
- // rushed, whatever
- setmetatable( package.loaded, {
- __newindex = function( t,k,v )
- if( k == "notification" && hasloaded == false ) then
- hasloaded = true;
- LoadLuaFileProtected( "client\\luastartup\\nm.lua" );
- LoadLuaFileProtected( "client\\luastartup\\lol.lua" );
- end
- rs( t,k,v );
- end,
- })
Advertisement
Add Comment
Please, Sign In to add comment