Question regarding callbacks in LOVE

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
KareemErgawy
Prole
Posts: 3
Joined: Sat Mar 08, 2014 11:43 am

Question regarding callbacks in LOVE

Post by KareemErgawy »

Hi,
During the past weekend I started exploring LOVE source code. I'll be working on LOVE mainly to enhance and build my engine programming skills. I would like to thank LOVE developers for the wonderful game engine.

Currently I studying how Lua integration is implemented. I managed to discover many details through debugging the code. Aspects such as Lua scripting engine initialization, SDL integration, wrapping C++ classes/modules to be exposed to Lua, and handling mouse and joystick events are now apparent to me.

I wanted to ask how are some callbacks are implemented? Specifically, love.draw, love.load, and love.run.

I don't need detailed explanation. Just pointers to the code on where I can debug and understand the C++ and Lua parts that are involved in implementing such callbacks.

Side note: I am studying Lua integration because I am thinking of integrating Mono runtime (specially C#) with the LOVE engine. If this is interesting to anybody in the community, I will be happy work in a team. I am doing this for fun and maybe, LOVE community may adopt this integration as another option besides Lua.
Last edited by KareemErgawy on Mon Mar 31, 2014 5:17 am, edited 1 time in total.
User avatar
slime
Solid Snayke
Posts: 3162
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Question regarding callbacks in LOVE

Post by slime »

KareemErgawy wrote:I wanted to ask how are some callbacks are implemented? Specifically, love.draw, love.load, and love.run.

I don't need detailed explanation. Just pointers to the code on where I can debug and understand the C++ and Lua parts that are involved in implementing such callbacks.
The code for the callback functions are all in src/scripts/boot.lua. love.update and love.draw are called by love.run, which is called by the function returned by boot.lua (which is called by the executable, in src/love.cpp.)

love.run also polls events every frame, and invokes the callback functions for those events.
KareemErgawy
Prole
Posts: 3
Joined: Sat Mar 08, 2014 11:43 am

Re: Question regarding callbacks in LOVE

Post by KareemErgawy »

slime wrote: The code for the callback functions are all in src/scripts/boot.lua. love.update and love.draw are called by love.run, which is called by the function returned by boot.lua (which is called by the executable, in src/love.cpp.)

love.run also polls events every frame, and invokes the callback functions for those events.
Thanks a lot slime
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 5 guests