FredyH / MySQLOO

MySQLOO
GNU Lesser General Public License v2.1
140 stars 55 forks source link

errors are ass in callbacks #21

Closed meepen closed 5 years ago

meepen commented 6 years ago

i'd recommend not using pcall and using call, or at least push AdvancedLuaErrorReporter (debug.getregistry()[1]) to the stack for pcall

FredyH commented 6 years ago

Do you have some reference that this exists on any gmod server and how it works? I tried googling it but couldn't find anything other than one other gmod addon using it.

Also, using call is extremely bad since the callbacks are run in the Think hook, which means a) Think is fucked b) no other callbacks are run c) lua errors will leak memory since they use longjmp and break RAII

meepen commented 6 years ago

Yes in cluainterface::init it creates and stores a cluaobject which is a index into the registry which means it should always be at that index. But you could just use call instead

On Mon, May 7, 2018, 4:51 AM FredyH notifications@github.com wrote:

Do you have some reference that this exists on any gmod server and how it works? I tried googling it but couldn't find anything other than one other gmod addon using it.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/FredyH/MySQLOO/issues/21#issuecomment-387001350, or mute the thread https://github.com/notifications/unsubscribe-auth/AF5lSZwCLpIF0t-j8KDRuoQm4_1iVtGCks5twAr3gaJpZM4TwRDP .

meepen commented 6 years ago

Sorry didn't see edits on email and you are right about it being bad to use call

On Mon, May 7, 2018, 9:36 AM Meepen meepdarknessmeep@gmail.com wrote:

Yes in cluainterface::init it creates and stores a cluaobject which is a index into the registry which means it should always be at that index. But you could just use call instead

On Mon, May 7, 2018, 4:51 AM FredyH notifications@github.com wrote:

Do you have some reference that this exists on any gmod server and how it works? I tried googling it but couldn't find anything other than one other gmod addon using it.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/FredyH/MySQLOO/issues/21#issuecomment-387001350, or mute the thread https://github.com/notifications/unsubscribe-auth/AF5lSZwCLpIF0t-j8KDRuoQm4_1iVtGCks5twAr3gaJpZM4TwRDP .

FredyH commented 5 years ago

Hopefully I did it correctly in 375488238393321625e0ee945d2abf89c1616b00