Last active
May 11, 2023 10:44
-
-
Save b0mbie/11154d2492742e20710f163dedf09326 to your computer and use it in GitHub Desktop.
Lua one-liner that adds a __call metamethod to numbers which multiplies given parameters with self and returns them.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| local s,u=select,table.unpack or unpack debug.setmetatable(3,{__call=function(x,...)local n,t=s('#',...),{}for i=1,n do t[i]=x*s(i,...) end return u(t,1,n)end}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment