Results 1 to 3 of 3

Thread: odd lua string issue

  1. #1
    Join Date
    Mar 2005
    Posts
    724

    Default odd lua string issue

    ok this may seem odd but I can get this simple line to work with G5 scripting but not G6

    all I get is nil for the variables.

    the code is

    Code:
    print (rawpwr) 
    --print(string.gsub(rawpwr, "%.", "%\n"))
    --linepwr = string.gsub(rawpwr, "%.", "%\n")
    
    _, _, pwrtime, pwrpercentage = string.find(rawpwr, "state:\s(.-)\s.-percentage:\s(.-)")
    print("state ", pwrstate)
    print("percent ",pwrpercentage)
    rawpwr is
    Code:
    state: fully-charged percentage: 100%

    I am a bit confused as the same code works in a G5 scripting action hopinh I am simply overlooking something that changed in the newer version of Lua

    Thanks,
    Yonu

  2. #2
    Join Date
    Mar 2005
    Posts
    724

    Default

    please disregard I just got it figured out I am an idiot i was using \s when I should have been using %s

    Yonu

  3. #3
    Join Date
    Jan 1998
    Location
    Jupiter, FL
    Posts
    13,553

    Default

    yes that is the ticket, sorry I didn't see you question earlier.
    Ron
    No support through PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •