generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: FYI: there's a new undocumented metamethod called __namecall

Previous Thread :: Next Thread 
Informable is not online. Informable
Joined: 10 Aug 2016
Total Posts: 1778
20 Apr 2017 04:44 AM
It's really weird and you can only find it by disassembling ROBLOX. It's only used in a few C-side parts of ROBLOX's Lua. It's fired whenever you use the : operator to call a method on a userdata (or on a table, but only if that method doesn't exist).

Its arguments are: self (table/userdata), the arguments of the call, and the method name (string)

Example:

local obj = newproxy(true)

getmetatable(obj).__namecall = function(...)
local args = {...}
print(args[1]) --the obj userdata
print(args[2]) --the 1st arg of the call
print(args[3]) --the 2nd arg of the call
print(args[#args]) --the method name
return 5 --value that the call returns
end

obj:test(1,2,3)
obj:asdf(true,"hi",math.pi)
local five = obj:thing()
print(five)


Report Abuse
Informable is not online. Informable
Joined: 10 Aug 2016
Total Posts: 1778
20 Apr 2017 04:47 AM
for clarity: I wrote that on the spot and didn't notice, but the 3rd arg in those test calls won't get printed (because args[1] is self)


Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
20 Apr 2017 04:52 AM
"or on a table"
Not on a table. Similar to __len, it only works on userdata. I just tested this, it does exist and it's pretty cool.


Report Abuse
Informable is not online. Informable
Joined: 10 Aug 2016
Total Posts: 1778
20 Apr 2017 04:53 AM
my bad, thanks for the correction


Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
20 Apr 2017 04:58 AM
Did you mention it to wiki staff? They might want to add this.


Report Abuse
Informable is not online. Informable
Joined: 10 Aug 2016
Total Posts: 1778
20 Apr 2017 05:05 AM
I feel like it's not meant to be documented. They just recently added some really strong security checks to the VM and certain functions like luaD_precall, and I *think* this is related to those specific changes. It's just some weird internal stuff that you can basically just use __index for anyway


Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
20 Apr 2017 05:06 AM
"I feel like it's not meant to be documented. They just recently added some really strong security checks ..."
Also known as forbidden knowledge?


Report Abuse
Informable is not online. Informable
Joined: 10 Aug 2016
Total Posts: 1778
20 Apr 2017 05:07 AM
yes


Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
20 Apr 2017 05:09 AM
How about I link them to this thread and let them decide?


Report Abuse
theUTMdiamond is not online. theUTMdiamond
Joined: 09 Feb 2016
Total Posts: 377
20 Apr 2017 05:09 AM
Cool!


Worship bait!1!1!11111!!!!!1
Report Abuse
Informable is not online. Informable
Joined: 10 Aug 2016
Total Posts: 1778
20 Apr 2017 05:10 AM
I don't have any contact with wiki writers, admins, etc
this is something that I've given up on entirely
so many people get into things like RBXDev easy, but I don't


Report Abuse
Informable is not online. Informable
Joined: 10 Aug 2016
Total Posts: 1778
20 Apr 2017 05:36 AM
nvm I thought you were asking me to link them


Report Abuse
AxonMega is online. AxonMega
Joined: 29 Aug 2014
Total Posts: 2403
20 Apr 2017 06:32 AM
That's sweet, thanks for letting us know!
Report Abuse
Informable is not online. Informable
Joined: 10 Aug 2016
Total Posts: 1778
20 Apr 2017 06:20 PM
np I hope more people see it


Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
20 Apr 2017 06:34 PM
Maybe it's undocumented because it's new 🤔
Report Abuse
Informable is not online. Informable
Joined: 10 Aug 2016
Total Posts: 1778
20 Apr 2017 07:10 PM
cnkillme you're the biggest critic on earth, why can't you just see a post and enjoy it for once


Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
20 Apr 2017 07:43 PM
because im bored
Report Abuse
Disillusions is not online. Disillusions
Joined: 10 Jul 2011
Total Posts: 6365
20 Apr 2017 07:44 PM
lmao


Report Abuse
Informable is not online. Informable
Joined: 10 Aug 2016
Total Posts: 1778
20 Apr 2017 11:57 PM
bump


Report Abuse
Informable is not online. Informable
Joined: 10 Aug 2016
Total Posts: 1778
21 Apr 2017 02:46 AM
I want more people to see this!


Report Abuse
GraphicsSettings is not online. GraphicsSettings
Joined: 12 Sep 2013
Total Posts: 2883
21 Apr 2017 02:53 AM
LOL, I actually seen this like 2 days ago because I accidently didnt put an argument for my function and it printed an error in Output talking about __namecall, but I didn't know dip about it.
Report Abuse
Informable is not online. Informable
Joined: 10 Aug 2016
Total Posts: 1778
21 Apr 2017 05:14 AM
I tried and couldn't get that error, I'm interested what did it say? :p


Report Abuse
Wasteds is not online. Wasteds
Joined: 10 Jul 2014
Total Posts: 615
21 Apr 2017 05:55 AM
Inbox.
Report Abuse
AxonMega is online. AxonMega
Joined: 29 Aug 2014
Total Posts: 2403
21 Apr 2017 06:50 AM
If I may ask, how or where did you find out about this?
Report Abuse
Informable is not online. Informable
Joined: 10 Aug 2016
Total Posts: 1778
21 Apr 2017 07:07 AM
I used evil nerd sorcery


Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image