Quantcast
Channel: Super Mario Bros. X Forums
Viewing all articles
Browse latest Browse all 2660

LunaLua Help • Re: Need help with lua? - LunaLua General Help

$
0
0
i am trying to make a library with the following structure:

library.lua

Code:

function onStart()    --Do stuffend
luna.lua

Code:

require("library")
for some reason, the onStart function in the library isn't called. i've tested playing a sound effect in the global scope of library.lua and luna.lua, as well as within a new onStart function within luna.lua, and these all trigger. but if it's specifically within the onStart specified within a require, it doesn't work. why is this happening?
functions in libraries should be registered to the library table.

Code:

local myLib = {}function myLib.onStart()endregisterEvent(myLib, "onStart")return myLib
If you simply have one onStart here, and another onStart in the script calling the library, then the script calling the library overwrites the onStart from the library.

Statistics: Posted by Emral — Thu May 01, 2025 3:38 am



Viewing all articles
Browse latest Browse all 2660

Trending Articles