Hi all!
I'm working on a large Love2D project using a library i've written to handle OOP, and i've decided to divide it into multiple files (one for each class plus main.lua and conf.lua). Whenever i need to instantiate or extend a class i'm simply requiring it with require "ClassName" and it just works fine.
While the project grows i've noticed that i'm repeating a lot of code for simple tasks like finding items inside tables and stuff like that, so i thought i could write some simple table extension functions, but i would like to use them in pure lua syntax without the need to require some specific library each time (ex: if table.contains(t, element) then etc...).
My first thought was to declare such extension methods in my main.lua, but i don't like this approach very much because i'd like to keep the file as clean as possible.
What would be the best way to extend Lua libraries (possibly by declaring my custom functions in a separate file) and "patch" them once in my main.lua so i can use them from everywhere without worrying to require them?
Thank you in advance
Correct way to extend Lua standard libraries
Who is online
Users browsing this forum: No registered users and 5 guests