__namecall and self

Vzurxy Jun 21st, 2019 (edited) 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- note this is for roblox exploiting
  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
  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.
  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
  15. return mt_namecall(self, ...) -- returns backup, so we dont completely overwrite this whole metatable.
  17. end)
  19. -- extra information : self, is usually operating on itself..., e.g:
  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())
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!