#my very very very simple metatable dont work
1 messages · Page 1 of 1 (latest)
You need to set a meta method I believe
I forgot the exact way how but you need to actually declare the behavior
Or maybe the function isn’t running I’m not too familiar with meta tables actually
** You are now Level 16! **
this is wrong
;compile lua lua local meta={ __newindex=function(a,b,c) print(a," ",b," ",c) end } local t=setmetatable({},meta) t.foo="bar"
table: 0x59b33ad01d40 foo bar

ok i will try that later today
@floral rivet can i also just type
setmetatable({},meta).foo = “bar”
wat
why would you ever do that
because its only 1 line
wait
wait nvm i see why that wont work
no it works you just wouldn't ever write it like that
why create metatable if only to immediately dispose of it? wasteful.
also can i ask why would this fix it
because this is my first time with metatables and i got zero clue what that’s doing
you set the metatable but didnt assign any new index lol
setmetatable(t,...) return t is missing a set, to test it. setmetatable(t,...) t.foo="bar" return t
anyway google lua metamethods
that should help. roblox docs probably has a page for it
I love this bc it’s unhinged
local function cursed() return (({} :: {[any]: any})[({} :: {[any]: any})] or function() return cursed() + ({} :: number) end)() end type shit
ok so: it worked by printing when i initially start the game but when i change one of the values inside the table nothing prints
mannnnn i give up on this metatable stuff
im just going to do this without a metatable since theres a very easy way to do it without
I decided to make this tutorial because I was struggling to understand metatables and their capability for a long time. With this tutorial I want to help people who are getting confused and have a hard time understanding them and their power. Introduction to Metatables: Metatables are a powerful feature in Luau, the programming language used i...
lemme do that... tomorrow
I do quantum mechanics at 2am whilst sick, what’s your excuse 
school tomorrow🗣️