Arrgghhhh .... What the h*** is going on

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • qwerty
    Forum Member
    • Oct 2006
    • 345

    Arrgghhhh .... What the h*** is going on

    this is driving me nuts, i've used the same code many many times before, just added it to my latest project and i get stuck in a looping error code

    i'm baffled, i've got to be over looking something stupid here i'm sure

    here is the code that is causing the headache, it is located in Global, and called from the PageTimer script for each page in my project, the Page.StartTimer call is made from the On.Show script for each page.... that is working ok. The GUID and current_GUID is defined in StartUp using a dll to get ardware fingerprint and my known fingerprint, this is also working fine (i currently have it set to a fake GUID so it thinks it's not my machine)

    Code:
    139     -- Timer Function --
    140 function TimerControl ()
    141 
    142 	 if GUID ~= current_GUID then  -- check if it's me
    143			
    144		 windows = Window.EnumerateTitles();
    145		
    146		 -- Window Title Targets --
    147		 window_name1 = "temp";
    148		 window_name2 = "ir_ext_temp";
    149		 window_name3 = "AutoPlay";
    150		
    151		 for handle, title in windows do  -- Loop through the table
    152			 -- Search for Target Text --
    153			 result1 = String.Find(title, window_name1, 1, false);
    154			 result2 = String.Find(title, window_name2, 1, false);
    155			 result3 = String.Find(title, window_name3, 1, true);
    156			
    157			 -- Check for match, close if true --
    158			 if (result1 ~= -1) then
    159				 Window.Close(handle, CLOSEWND_SENDMESSAGE);
    160			 elseif (result2 ~= -1) then
    161				 Window.Close(handle, CLOSEWND_SENDMESSAGE);
    162			 elseif (result3 ~= -1) and (String.Length(title) == 8) then
    163				 Window.Close(handle, CLOSEWND_SENDMESSAGE);
    164			 end
    165		 end
    166		
    167	 end
    168 end

    and here is the error i am getting.....
    On Timer, Line153: attempt to index a string value

    .... can someone tell me if they have seen this before? i've looked through the rest of the project, and i haven't used those variables before, or clashed any of the other things in that code that i can see


    i even deleted this and copied the example directly from the help files and i am still getting the same error related to the same line of code
  • qwerty
    Forum Member
    • Oct 2006
    • 345

    #2
    i found it ...


    i had this in the global code, which i use for generating random filenames

    Code:
    -- Generate random strings with defined character sets using the Lua internal character classes. --
    
    local Chars = {}
    for Loop = 0, 255 do
       Chars[Loop+1] = string.char(Loop)
    end
    local String = table.concat(Chars)
    
    local Built = {['.'] = Chars}
    
    local AddLookup = function(CharSet)
       local Substitute = string.gsub(String, '[^'..CharSet..']', '')
       local Lookup = {}
       for Loop = 1, string.len(Substitute) do
           Lookup[Loop] = string.sub(Substitute, Loop, Loop)
       end
       Built[CharSet] = Lookup
    
       return Lookup
    end

    I think i can sort it out by changing the wording of the "Local String" part

    Comment

    • qwerty
      Forum Member
      • Oct 2006
      • 345

      #3
      slight adjustment to the fix above, i put that code back inside the function that uses it (in the global section still) and it seems to have fixed the problem, looks like i had a copy and paste error :o and ended up with it above the "function" line

      Comment

      Working...
      X