Lua Object-Orientation

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Introduction

Lua itself offers no class system. It is, however possible to implement classes and objects as tables with just a few tricks.

Syntax

  • function <class>.new() return setmetatable({}, {__index=<class>}) end


Got any Lua Question?