Thread Tools Display Modes
01/27/23, 05:21 PM   #1
quentinlamamy
 
quentinlamamy's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2016
Posts: 24
Lightbulb 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 ?
  Reply With Quote
01/27/23, 05:49 PM   #2
Sharlikran
 
Sharlikran's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 626
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.
  Reply With Quote
01/27/23, 06:43 PM   #3
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
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
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

Last edited by Baertram : 01/27/23 at 06:46 PM.
  Reply With Quote
01/28/23, 02:55 AM   #4
quentinlamamy
 
quentinlamamy's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2016
Posts: 24
Thumbs up

Originally Posted by Sharlikran View Post

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

Originally Posted by Baertram View Post
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
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
  Reply With Quote
01/28/23, 07:14 AM   #5
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
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 :-)
  Reply With Quote
01/29/23, 01:24 AM   #6
quentinlamamy
 
quentinlamamy's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2016
Posts: 24
Originally Posted by Baertram View Post
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
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » ESO Lua Interpreter - Infinite loop undetected

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off