We have moved at community.getvera.com

Author Topic: loader.lua does not like forward slashes  (Read 1154 times)

Offline ronluna

  • Jr. Member
  • **
  • Posts: 96
  • Karma: +1/-3
loader.lua does not like forward slashes
« on: May 15, 2017, 02:02:06 pm »
Apparently openluup does not like forward slashes inside variables.

loader.lua complains about being unable to concat when a "/" is part of a string inside a variable. (Line 283) while loading a plugin

Code: [Select]
local source_code = table.concat (loadList, '\n')             -- concatenate the code

I had to insert the value in decimal and convert to character in order to bypass the complaining...

Code: [Select]
local slash = string.char("47")
local end_request = "<" ..slash.. "IRCCCode><" ..slash.. "u:X_SendIRCC><" ..slash.. "s:Body><"..slash.. "s:Envelope>"

wondering if anyone else has experience something similar?



Offline reneboer

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1574
  • Karma: +110/-31
Re: loader.lua does not like forward slashes
« Reply #1 on: May 16, 2017, 08:57:37 am »
Hi,

The forward slash is a special character so you need to use the escape character. I.e. when you want to use / put \/ in the string and it should work. For some reason Vera LUA does not complain about it, but most other LUA implementations probably will. I know the one on a PI does :-)

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 ronluna

  • Jr. Member
  • **
  • Posts: 96
  • Karma: +1/-3
Re: loader.lua does not like forward slashes
« Reply #2 on: May 16, 2017, 10:38:38 am »
Thanks for the head up ... Although I did try your suggestion before the Hex conversion but for some reason it did not like escaping the "/" with a "\" ... it was weird though...