Advertisement
Vzurxy

__namecall and self

Jun 21st, 2019
482
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.27 KB | None | 0 0
  1. -- note this is for roblox exploiting
  2.  
  3. local mt = getrawmetatable(mt) -- Gets metatable of game, also bypasses __metatable error
  4. local mt_namecall = mt.__namecall -- Create a backup metatable of game
  5. do setreadonly(mt, false) end -- Makes a new scope and makes it writeable as well as readable
  6.  
  7. mt.__namecall = newcclosure(function(self, ...) -- Wraps a function in a C (more undetectable), and assigns 2 args, the thing being called on by the method, e.g: :Destroy, :Remove, and ... as extra args
  8. local args = {...} -- Wraps all extra parameters in a table
  9. local method = table.remove(args) -- Gets the method being used, e.g: :Destroy, :Remove, always last arg.
  10.  
  11. if self.Name == "whopie" then -- check if the object being called on by a method is named whopie
  12. return "OH HELLO THERE" -- return a shitty return thing
  13. end
  14.  
  15. return mt_namecall(self, ...) -- returns backup, so we dont completely overwrite this whole metatable.
  16.  
  17. end)
  18.  
  19. -- extra information : self, is usually operating on itself..., e.g:
  20.  
  21. local table = {ass = "cheesy"}
  22. function table:smellass() -- gives it a colon : which adds a secret parameter, self. it can also be : table.smellass(self), must be 1st arg
  23. return self.ass -- instead of table.ass, more better coding practice...
  24. end
  25. print(table:smellass())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement