Advertisement
SergOmarov

LibraryHelpInjector

Apr 19th, 2016
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.49 KB | None | 0 0
  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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement