Author Topic: LuaTest - A Tool for Testing Scene Lua Code  (Read 34447 times)

Offline parkerc

  • Sr. Hero Member
  • ******
  • Posts: 2458
  • Karma: +35/-48
  • Life Moves Pretty Fast....
Re: LuaTest - A Tool for Testing Scene Lua Code
« Reply #75 on: November 14, 2017, 11:42:35 am »
 Hi

Yes the code in lua start up is still there..

Code: [Select]
-- lua testing code

local rblt = require("RBLuaTest")
rbLuaTest = rblt.rbLuaTest
luup.register_handler("rbLuaTest","LuaTest")

And running this

http://192.168.1.183:3480/data_request?id=lr_LuaTest

sadly still give me a No Handler error ?
« Last Edit: November 14, 2017, 11:45:08 am by parkerc »

Offline jswim788

  • Hero Member
  • *****
  • Posts: 787
  • Karma: +57/-2
Re: LuaTest - A Tool for Testing Scene Lua Code
« Reply #76 on: November 14, 2017, 12:36:35 pm »
Do you see anything in the log during the start up that indicates a problem with the code you list?

Offline parkerc

  • Sr. Hero Member
  • ******
  • Posts: 2458
  • Karma: +35/-48
  • Life Moves Pretty Fast....
Re: LuaTest - A Tool for Testing Scene Lua Code
« Reply #77 on: November 14, 2017, 12:43:43 pm »
Good point (many thanks)

And yes checking the logs there is a huge long list of red, starting with this.

Quote
01   11/14/17 16:30:32.251   LuaInterface::LoadCode: [string "function scene_2()..."]:588: '<eof>' expected near 'end' <0x77457320>
01   11/14/17 16:30:32.379   JobHandler_LuaUPnP::Run cannot start lua with code:
function scene_2()

local host = "192.

I removed the offending code (in a scene) and it is working now, (thanks) although Im surprised I did not get any errors messages via the UI ??

I did not realise that all the lua code i have added - e.g for the start up and the scenes is loaded at once (in bulk) I assumed it was split so you would get an error if either had an issue ?
« Last Edit: November 14, 2017, 04:08:16 pm by parkerc »

Offline jswim788

  • Hero Member
  • *****
  • Posts: 787
  • Karma: +57/-2
Re: LuaTest - A Tool for Testing Scene Lua Code
« Reply #78 on: November 14, 2017, 05:51:46 pm »
I did not realise that all the lua code i have added - e.g for the start up and the scenes is loaded at once (in bulk) I assumed it was split so you would get an error if either had an issue ?
Need someone else to answer this - I'm not familiar with the detail of the startup sequence.  I just take it for what it is and hunt down errors that I see and fix them...

Offline reneboer

  • Hero Member
  • *****
  • Posts: 1360
  • Karma: +77/-30
Re: LuaTest - A Tool for Testing Scene Lua Code
« Reply #79 on: November 15, 2017, 08:11:44 am »
Hi Parker,

I think the vera runs by all scene conditions on startup looking at the log file, so if you have LUA in a scene it will probably get loaded at startup. Other code is indeed loaded when needed.

Cheers Rene
2xVeraLite, VeraEdge, openLuup, ALTUI, 20 switches, 10 dimmers, 20 sensors, 10 scene controllers, 1 Harmony Hub, many plug-ins. Not enough time.

Offline RexBeckett

  • Master Member
  • *******
  • Posts: 3891
  • Karma: +482/-12
LuaTest 1.7
« Reply #80 on: January 12, 2018, 09:19:31 am »
I have updated LuaTest to work with the new security enhancements planned for Vera 7.27. It should also work with earlier UI versions - including UI5.

The security enhancements do not permit requests in the form: http://<veraip>:3480/data_request....
Instead they must be formatted as: http://<veraip>/port_3480/data_request....

I have updated the user guide to reflect the new format for invoking LuaTest. Apart from this change, LuaTest 1.7 functions in the same way as version 1.6.

To use the new version, download it from the first post in this thread and upload it to Vera as explained in the user guide.
« Last Edit: January 12, 2018, 09:21:28 am by RexBeckett »

Offline parkerc

  • Sr. Hero Member
  • ******
  • Posts: 2458
  • Karma: +35/-48
  • Life Moves Pretty Fast....
Re: LuaTest - A Tool for Testing Scene Lua Code
« Reply #81 on: January 12, 2018, 09:35:43 am »
Hi @Rex !

Hope youre well.

Thanks for doing that - Ill update my install and have a play with it tonight.

QQ - Does your update also include the colour coding of words that was previously shared ?

Offline RexBeckett

  • Master Member
  • *******
  • Posts: 3891
  • Karma: +482/-12
Re: LuaTest - A Tool for Testing Scene Lua Code
« Reply #82 on: January 12, 2018, 06:57:06 pm »
Hi @Rex !

Hope youre well.

Thanks for doing that - Ill update my install and have a play with it tonight.

QQ - Does your update also include the colour coding of words that was previously shared ?
Hi Chris,

Yes I'm OK, thanks. I updated my version of LuaTest code having realised that the forthcoming changes would have stopped it working. I didn't change anything else.

Offline parkerc

  • Sr. Hero Member
  • ******
  • Posts: 2458
  • Karma: +35/-48
  • Life Moves Pretty Fast....
Re: LuaTest - A Tool for Testing Scene Lua Code
« Reply #83 on: January 13, 2018, 01:08:47 pm »
Thanks.

As I still do most of my coding/testing on my Vera3 running UI5, that backwards compatibility is always appreciated.

Offline RexBeckett

  • Master Member
  • *******
  • Posts: 3891
  • Karma: +482/-12
Re: LuaTest - A Tool for Testing Scene Lua Code
« Reply #84 on: January 13, 2018, 06:38:08 pm »
Thanks.

As I still do most of my coding/testing on my Vera3 running UI5, that backwards compatibility is always appreciated.
If you recall, Chris, I wrote LuaTest for you and your iPad. :) I've tried to keep it compatible with just about any browser and be UI version agnostic.

I noticed that there were nearly 800 downloads of V1.6 so we seem to have helped a lot of people develop their Lua coding skills.

Offline parkerc

  • Sr. Hero Member
  • ******
  • Posts: 2458
  • Karma: +35/-48
  • Life Moves Pretty Fast....
Re: LuaTest - A Tool for Testing Scene Lua Code
« Reply #85 on: August 18, 2018, 04:33:49 am »
If you recall, Chris, I wrote LuaTest for you and your iPad. :) I've tried to keep it compatible with just about any browser and be UI version agnostic.

;D  Im eternally grateful for you for doing that  ;)

It should be an essential part of anyones  Lua/Vera coding tool kit..

Offline parkerc

  • Sr. Hero Member
  • ******
  • Posts: 2458
  • Karma: +35/-48
  • Life Moves Pretty Fast....
Re: LuaTest - A Tool for Testing Scene Lua Code
« Reply #86 on: August 18, 2018, 04:37:23 am »
Does anyone else notice a limit on the number of lines of code you can save via LuaTest?

I use Textastic to ensure Im using the correct structure for my code, and then paste it into LuaTest to check and do minor tweaks. But Ive noticed that the more lines I try to paste it wont save - retuning a error page ?

"Safari cannot open the page as the network connection was lost?"

If I reduce the number of lines, it saves fine, no connection error screen?

As I know there should be no connection issues, could this be a memory resource issue on Vera itself ? Trying to save to much at one time , or is it  something else ? Either way any idea of a fix?
« Last Edit: August 18, 2018, 05:03:53 am by parkerc »

Offline HSD99

  • Sr. Member
  • ****
  • Posts: 276
  • Karma: +11/-0
Re: LuaTest - A Tool for Testing Scene Lua Code
« Reply #87 on: August 18, 2018, 11:13:16 am »
The topic is addressed earlier in the thread.

Offline parkerc

  • Sr. Hero Member
  • ******
  • Posts: 2458
  • Karma: +35/-48
  • Life Moves Pretty Fast....
Re: LuaTest - A Tool for Testing Scene Lua Code
« Reply #88 on: August 24, 2018, 11:49:08 am »
Thanks @HSD99

I had missed that.

Quote
Rex, is there a limit to the size of the code that I can debug in the LuaTest window?

There is a limit although I have never hit it. The constraint is the maximum length of the http request supported by the browser and Vera.

You could work around this by moving any code that is already debugged to global functions in Startup Lua.

Offline amg0

  • Sr. Hero Member
  • ******
  • Posts: 2993
  • Karma: +203/-8
Re: LuaTest - A Tool for Testing Scene Lua Code
« Reply #89 on: August 24, 2018, 05:41:54 pm »
FYI Altui implements this in its lua test window with a POST so no limits any more here.