UltraStar-Deluxe / USDX

The free and open source karaoke singing game UltraStar Deluxe, inspired by Sony SingStarâ„¢
https://usdx.eu
GNU General Public License v2.0
808 stars 160 forks source link

Have TLua_CustomRequire put the module table on the Lua stack. #854

Closed hoehermann closed 1 week ago

hoehermann commented 1 month ago

Hi all

Ever since Lua 5.2 released in 2011, people are encouraged to store the result of require locally, see http://lua-users.org/wiki/CompatibilityWithLuaFive section "Standardize calls to require()".

This bit me quite hard the other day when I tried to create a more involved party mode and could not get external modules to load. I was short of removing the custom require function since its apparent convenience breaks compatibility with any module which was written in the past ten years. But then I realized I could make it return the last module table which seems to solve the issue for everyone. 🙂

Kind Regards Hermann

barbeque-squared commented 1 week ago

UPDATE: it's also erroring on the base branch, either my environment is off or there's something custom somewhere where it's not supposed to be. UPDATE2: yes it's accessing a custom thing I only have available in my local builds, I'll test this PR on there instead

hoehermann commented 1 week ago

Thank you very much. ♥