Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Hyomoto

7
Posts
5
Topics
A member registered Jan 01, 2023

Recent community posts

Damn it, sorry about that YAL.  I promise I actually did read the manual, even that part ... just not after finding the error.  I'll give the in-dev version a shot as well, it can be my penance for not checking the manual first.

Certain types of errors, such as the one in my last post, do not trigger the lua_error_handler if defined.  In these cases the state just silently fails without the function being called.

(1 edit)

I have a good one today.  Test is fairly simple, expose a function to the Lua state via GML, call a lua file which contains requires(), and then have that module try to call the function exposed.  The error passed is attempt to yield across a C-call boundary.  The function will execute fine if called from the source file, it's only when called via requires that the error pops.

Lua error: attempt to yield across a C-call boundary

stack traceback:

[C]: in field 'text'

./core/sprites.lua:3: in main chunk

[C]: in function 'require'

core/data.lua:2: in main chunk

The lua_error_handler entry says "lua_error_handler : script(text, state_id)" however, it passes state_id, text.

(1 edit)

From the cheat sheet, "Returns whether all steps succeeded."  However, whether or not the code succeeded at being added, it always seems to return 0.  I'm assuming this is there so you can check if a snippet actually compiled or not and handle the error if it doesn't, but as is it seems that isn't possible.  I was able to hijack the lua_error_handler to set a flag, but this is definitely not the desired behavior.

That's what I ended up doing.  I do feel a bit silly having gotten stumped by such a trivial thing, but I guess I'm just very used to working during the pragma section for initialization tasks.  Otherwise the experience out of the box is incredible.  I find a lot of libraries tend to be overly complex, but once I got past this small hurdle Apollo works as expected with little fuss or fanfare.  It was mostly just a technical detail I got hung up on because while the cheat sheet seems to make it pretty clear you just need to call lua_state_create() to get started, my issue was that because it wasn't working I didn't know if I was missing some detail or if it was something else and, as it turned out, it was something else.

I don't know how vital it would be, but a "hello world" in Apollo would've got me digging into the extension earlier and fussing less over missing documentation which is what prompted the initial post.  Given the lack of similar I'm probably an outlier though I won't be upset to see it in an updated version.

(5 edits)

Hello, YAL.  The cheat sheet seems very straight-forward about getting started, but Apollo crashed immediately saying that lua_buffer is not defined when I tried to run lua_add_code().  Poking in the files I found lua_init() but this isn't called by the extension (it is shown as the init function in apollo_core.gml though), nor is it documented on the cheat sheet.  Also, I also get an error on first project reload saying Apollo.yy is missing and had 1 reference.  It might be that newer versions of GM are borking something.  Still, I couldn't find any quick start references or the like, just the cheat sheet, so I'm not sure if I'm just missing an obvious piece of documentation.

EDIT: Immediately after posting this I started thinking: perhaps this function IS called and it's just during the "pragma" phase that it's unavailable and ... yup.  That's it.  If you wait until an object even to run it works fine, but if you try to call the code during an initialization period beforehand, I'm guessing the extension just hasn't called it's init functions yet.  So, issue solved.  It is starting correctly, there's just a period of time when it will crash if called.  The obvious workaround is to clear it from the extension and just call it myself, not sure if that info is helpful to anyone but here it is.