Can you please answer if possible as I have no Idea.

Also can you please help me understand this example?

local t = {hi = 2,lol = 2}
local meta = {hi=10}

setmetatable(t,meta)

print(getmetatable(t).hi)

5 comments

0

I can't really explain it since it's a bit broad but I can give you a video: https://www.youtube.com/watch?v=3On86eQRccc Also popular games sometimes use metatables if they want to shorten code. Take an AI zombie for an example, a zombie shooter game might want to make different themed zombies, they can still use the zombie "source code" but alter a few things like it's health, damage, speed,

0

intelligence. They are reusing something and altering a few things. Most of the time they don't need metatables anyway. Take an automobile for example, a car and motorcycle share the same traits (gasoline, gas pedal etc) but an automobile creates those. A motorcycle may have two wheels and no radio while a car has four wheels and a radio.

0

Downvoted and started moderations as you are too broad. I recommend going to https://scriptinghelpers.org/blog/posting-good-questions-and-answers-on-scripting-helpers

0

Popular games are usually closed source

0

@raid6n this question isn't even close to being too broad lol