Solarus 1.6 Tutorial [en] - #50: Metatables

Subscribers:
2,910
Published on ● Video Link: https://www.youtube.com/watch?v=sLcGCV2qpbM



Category:
Tutorial
Duration: 18:46
147 views
8


How to program a global behavior of all objects of the same type without duplicating the code? Metatables, a very powerful Lua feature, are an elegant answer to that problem.

The metatable of a type specifies the shared behavior of all objects of this type. When you assign a function to the metatable of a type, everything is like if all objects of that type had this function.

You can for instance define a default event on the sensor type instead of having to search for every sensor instance.

- Video made with Solarus 1.6.
- Download Solarus : https://www.solarus-games.org/en/solarus/download
- Solarus documentation : http://www.solarus-games.org/doc/latest/
- How to program in Lua: http://www.lua.org/pil/contents.html
- Solarus Discord: https://discord.gg/yYHjJHt







Tags:
Solarus
tuto
tutoriel
tutorial
Zelda
Zelda Classic
Legend
2D
fangame
RPG
RPG Maker
Let's Play
Solarus Quest Editor
game
game engine
Lua