FG Spreadshirt Swag
  1. #1

    I'm stuck trying to understand why I'm locked up when I try to do something in LUA..

    I've got DB entries for a list of things like sRecord = "reference.npcdata.aarakocra@DD MM Monster Manual".

    I apply that DB.getChildren to loop around this list of entries and lookup up data in them to apply filters to each one and put the results in a combobox.

    If I just loop around and add them into the combobox - all works. But the second I start accessing the nodes in a seperate LUA function as follows:

    Code:
    	local nodeTarget = window.getDatabaseNode();
    	if not nodeTarget then
    		return false;
    	end
    ... get some local data for setting up some of the filter... 
    
    	local nodeSource = DB.findNode(sRecord);
    	if not nodeSource then
    		local sRecordSansModule = StringManager.split(sRecord, "@")[1];
    		nodeSource = DB.findNode(sRecordSansModule .. "@*");
    		if not nodeSource then
    			return false;
    		end
    	end
    ... get data and try to determine if record fits filter criteria...
    It literally locks up and never returns. I can put system messages going out to chat and I can see everything gets done super fast - but when it exits my code having completed the filtering and combobox additions - FGU is completely locked up.

    I've chopped out all the code above and it works fine (ie. no filtering). I add in just the first window.getDatabaseNode(); and everything radically gets locked up someplace after my code.

    I have no idea what is happening, or why that simple line causes stuff to simply get lost after it leaves my program.

    Any hints as to why this might be happening? I've put system messages all over my code and it simply is done with what I'm doing and drops dead somewhere in FGU. But ONLY when I add in the above code snippet within the DB.getChildren loop I described with the data I described.

    [Additionally: If I only have 2-3 sRecords its only crippling slow - just on the other side of usable. But put 17 records? It's dead. At least as far as my patience lasts. Is there some secret way I'm supposed to access these records other than what I'm showing above? For sure once they are IN the combo box they are fine. It's after the fitlering that some mysterious HUGE delay happens after my code has done all its work and returns to FGU.]

    [Additionally Additionally: It does not matter if the references are in the local db.xml either (as in copies of the NPCs). I suspect using combobox may have been a mistake.]
    Last edited by SilentRuin; July 15th, 2020 at 23:16.
    Free(Forums/Forge) Extension(FGU 5E):
    Paid (Forge) Extension(FGU 5E):

  2. #2
    Unbelievable. I took out all my many and prolific debug statements to track all the things I was doing and filtering... and wala. Works fast now.

    That's a lesson I had no idea was there to be had. Usually debug prints are nothing.
    Free(Forums/Forge) Extension(FGU 5E):
    Paid (Forge) Extension(FGU 5E):

  3. #3
    They are writing both to the console UI, and immediately to disk. (and disk operations are relatively slow)
    Debug statements are specifically not cached; so that you can look at the disk log if scripts cause crashes.

    Regards,
    JPG

  4. #4
    Quote Originally Posted by Moon Wizard View Post
    They are writing both to the console UI, and immediately to disk. (and disk operations are relatively slow)
    Debug statements are specifically not cached; so that you can look at the disk log if scripts cause crashes.

    Regards,
    JPG
    Even with disk writing, there was something wrong. 17 items in a loop should not lock the system for minutes (or longer than I was willing to wait). I suspect there is a serious flaw or deadlock somewhere in those. Easy to duplicate for sure, but probably low priority in your queue - or should be. Just something to remember.
    Free(Forums/Forge) Extension(FGU 5E):
    Paid (Forge) Extension(FGU 5E):

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
5E Character Create Playlist

Log in

Log in