Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

The reason is that GML and Lua each have their own respective garbage collector, which complicates the process of sharing garbage-collected values between the two. This is much easier to do when everything is in the same runtime, which is the case with MoonSharp.

I was able to implement GML➜Lua referencing in the last update since Lua has a pretty convenient (although not well documented) mechanism with “cleanup” functions in custom objects (__gc), but doing it the other way around requires using GMS2.3 weak references, which I have not deeply investigated yet, and which I’ve not seen actively used by community (meaning that it’s possible that there are bugs).

A workaround would be to make a Lua-side system that would assign indexes for functions that are to be returned to GML and store them in a table for later invocation.