Lua variable errors

Discussion on the Lua Scripting capabilities for RaceCapture/Pro. Also see the <a href="http://autosportlabs.net/RaceCapturePro_Lua_Scripting">Lua Scripting Guide</a>

Moderators: JeffC, stieg

Post Reply
redparchel
Posts: 22
Joined: Fri Nov 01, 2013 9:48 pm
Location: Bay Area, CA

Lua variable errors

Post by redparchel »

I'm running into something that I'm unsure if it's a known limitation of this implementation of lua, my set up, or me just doing it wrong. When trying to use variables in the lua scripting my code fails to upload to the RCP correctly. I see that using vars should be possible as they're used on the latest Facebook posts about the shift light, but I know it's completely possible they're using a sweet new unreleased/undocumented firmware. some examples of my attempts:

Code: Select all

function onTick&#40;&#41;
  varA=0
end
I write this to the RCP, reboot the RCP and and read it again from the RCP and RA shows this:
"function onTick()
varA
This also happens when trying to set a variable to the output of a function:

Code: Select all

function onTick&#40;&#41;
  varB = getGpsSpeed&#40;&#41;
end
becomes:
"function onTick()
varB
RCP firmware 1.2.6
RA v1.1.14
Windows XP (it's the only windows box I have)


Sidenote: is there a method of logging output somewhere from lua, like a println to the logs for trouble shooting (i saw this mentioned on the forums as an idea but not if it had made it in as a feature)

thanks!

rdoherty
Posts: 215
Joined: Fri Mar 08, 2013 3:32 am

Post by rdoherty »

Hey redparchel, this looks like a bug in RaceAnalyzer. Not sure why it's clobbering your Lua script. I'll look into it more.
Ryan Doherty
Autosports Labs

brentp
Site Admin
Posts: 5986
Joined: Wed Jan 24, 2007 6:36 am

Post by brentp »

Hi, redparchel - we're working on that very problem. Thanks for your patience and hang tight for an update!
Brent Picasso
CEO and Founder, Autosport Labs
Facebook | Twitter

redparchel
Posts: 22
Joined: Fri Nov 01, 2013 9:48 pm
Location: Bay Area, CA

Post by redparchel »

Most excellent! Thanks for looking into this.

brentp
Site Admin
Posts: 5986
Joined: Wed Jan 24, 2007 6:36 am

Post by brentp »

Be sure to get v1.2.8 firmware and the latest version of RCP - we've made many improvements around this area.
Brent Picasso
CEO and Founder, Autosport Labs
Facebook | Twitter

mattlqx
Posts: 13
Joined: Mon Jun 17, 2013 12:55 am

Post by mattlqx »

Running 1.2.8 and 1.1.15, still can't get it to write properly. If anything is in the onTick() function, the write "fails" at 96%. The read back results in a truncation of what I tried to write and a random string of garbage. If I have a blank onTick(), then write completes 100% okay.

brentp
Site Admin
Posts: 5986
Joined: Wed Jan 24, 2007 6:36 am

Post by brentp »

Hi mattlqx,

We've identified the problem you're seeing in the 1.2.8 firmware and we have a preliminary fix in the V2 beta firmware, where we've fixed the lua script read/write routine.

Stay tuned for that release coming up in a few days - thanks for your patience!

-Brent
Brent Picasso
CEO and Founder, Autosport Labs
Facebook | Twitter

Post Reply