dual-universe / lua-examples

This repository has been created to serve as a sharing and learning platform for the Dual Universe community and the development of simple and complex Lua applications. You will find on this repo the examples released by Novaquark during the devblog and thread.
https://www.dualuniverse.game
GNU General Public License v3.0
59 stars 19 forks source link

Update system to make DUSystem be an instance and not a function and … #16

Closed PerMalmberg closed 1 year ago

PerMalmberg commented 1 year ago

…fix compile error

PerMalmberg commented 1 year ago

My two cents here, but the only really necessary change here is on line 378, with DUSystem = System(), maybe also adding system = System() too since that's also a global.

You do need this one too: https://github.com/dual-universe/lua-examples/pull/16/files#diff-c7964aa2027dc5b651ee1e7fc0660a97294405e2f21724a8585dc8662cc81eccR374

without it you're passing a function into setmetatable i.e. Systemis both a table, then redefined as a function.

Adding system = DUSystem is doable I guess. It wasn't in the original code, I assumed it was left out for a reason such as system being replaced with DUSystem. Maybe @NQ-Ligo can let us know the correct approach?