SergOmarov

LibraryHelpInjector

Apr 19th, 2016
78
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --LibraryHelpInjector © SergOmarov, 2015
  2. local lib=function(helpFile,targetLibrary)
  3.     local newLib={}
  4.     local help=dofile(helpFile)
  5.     local funcMeta=setmetatable({__call=function(o,...) return o.f(...)end,__tostring=function(o)return o.h end,__newindex=function()error("this is function")end,__index=function()error("this is function")end})
  6.     for k,i in pairs(help) do
  7.         newLib[k]=setmetatable({f=targetLibrary[k],h=i},funcMeta)
  8.    
  9.     end
  10.     return newLib
  11.  
  12. end
  13. return lib
RAW Paste Data