ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Lua/XML Help (https://www.esoui.com/forums/forumdisplay.php?f=175)
-   -   ESO Lua Interpreter - Infinite loop undetected (https://www.esoui.com/forums/showthread.php?t=10431)

quentinlamamy 01/27/23 05:21 PM

ESO Lua Interpreter - Infinite loop undetected
 
Hi,

I just see when coding that the eso client lua interpreter doesn't detect an infinite loop of a functio ncalling itself and run the addon. There is no check before execution ?

Sharlikran 01/27/23 05:49 PM

Code:

local function OnAddOnLoaded(eventCode, addonName)
  if addonName == YourModNameAsAString then
    EVENT_MANAGER:UnregisterForEvent(YourModNameAsAString, EVENT_ADD_ON_LOADED)
    DoInitStuff()
  end
end
EVENT_MANAGER:RegisterForEvent(YourModNameAsAString, EVENT_ADD_ON_LOADED, OnAddOnLoaded)

YourModNameAsAString has to match the manifest file or the text file and the folder name.

If that isn't what you need then I have no idea what you mean. Other then yes Lua, interpreter, and infinite loop I get that, but not sure what you mean.

Baertram 01/27/23 06:43 PM

No, there is no check.
lua will do what you tell it to do and ESO will freeze and crash if your loops take too long or are infinite :p
You need to handle that with some variables, like a maxLoops number or a boolean check or similar, yourself.

Best you can do is use an IDE which shows you recursive calls of your functions, leaking global variables etc. so you can check that yourself before doing the next /reloadui ingame.

https://www.esoui.com/forums/showthread.php?t=9875

quentinlamamy 01/28/23 02:55 AM

Quote:

Originally Posted by Sharlikran (Post 47041)

YourModNameAsAString has to match the manifest file or the text file and the folder name.

If that isn't what you need then I have no idea what you mean. Other then yes Lua, interpreter, and infinite loop I get that, but not sure what you mean.

Try to create inside your addon a function calling itself you will see :)

Quote:

Originally Posted by Baertram (Post 47049)
No, there is no check.
lua will do what you tell it to do and ESO will freeze and crash if your loops take too long or are infinite :p
You need to handle that with some variables, like a maxLoops number or a boolean check or similar, yourself.

Best you can do is use an IDE which shows you recursive calls of your functions, leaking global variables etc. so you can check that yourself before doing the next /reloadui ingame.

https://www.esoui.com/forums/showthread.php?t=9875

No need for an IDE, it was the night, i run out of coffee, just a little mistake. I was just a bit surprised to see my code running with a so big mistake inside.

Dear moderation : Please mark this thread a resolved

Baertram 01/28/23 07:14 AM

Quote:

Dear moderation : Please mark this thread a resolved
No need to, we just leave the threads in here open so anyone can add if he got further points or ideas, info.
It's too much work to edit all threads and change their name to be honest (imho).

Only the "Wishlist" or "Bug reports" threads about the ESOUI website issues and ZOs bugs get that extra love :-)

quentinlamamy 01/29/23 01:24 AM

Quote:

Originally Posted by Baertram (Post 47055)
No need to, we just leave the threads in here open so anyone can add if he got further points or ideas, info.
It's too much work to edit all threads and change their name to be honest (imho).

Only the "Wishlist" or "Bug reports" threads about the ESOUI website issues and ZOs bugs get that extra love :-)

Ok, sorry it's an old habit to close topic on board to let them clean


All times are GMT -6. The time now is 02:04 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI