Open Python1320 opened 7 years ago
https://github.com/danielga/gmod_require
Please fix this. It's so easy, even your kids can do it. And if modules depend on tier0 or vstdlib, for example, you can also make it so you don't need a relative path (like bin/libtier0.so) and just linking with the file (ldd will report it as just libtier0.so) will work. This is so annoying because it requires an impressive amount of hacks.
Not going to happen.
I don't see any reason for require to not be completely fixed at once.
I see no reason why this should not be fixed
This has been a problem for quite a while @robotboy655 @willox
can't really fix it without breaking modules returning random values at the end of gmod13_open
they completely ignore that return value
Most modules I've seen just return 0 for no returns - even if they didn't, the returns wouldn't be utilised by current Lua code. Modules should be able to return from require and take arguments.
Boggles the mind how this could go unfixed for so long. I just don't understand. I can't understand.
Obligatory almost three years later bump
Issues
require('modulename')
never returns anything for either pure lua files or binary modules.Details
require() is apparently supposed to return success values, but it has never done this. Require on pure lua modules should return whatever the module lua file returns the very least, this does not happen either. We could greatly benefit from having the original behaviour of Lua by the means of code reuse from any normal pure lua library. There are NO drawbacks for this.
Just because require has been like this for as long as I can remember does not mean it isn't a bug. Not being able to use third party libraries without modifications is a pretty darn big bug in my books.
Steps to reproduce
Imagine being able to use https://github.com/ToxicFrog/vstruct just by the means of copypaste instead of having to do something like this: https://github.com/Python1320/gmod_vstruct/blob/master/lua/includes/modules/vstruct.lua