Valid syntax for Luup device variable names?

Can anyone enlighten me as to what constitutes a valid Luup variable name? I’ve successfully (by accident) created names with spaces, so it’s obviously more than alphanumeric, but what about other characters? What about length of the name?? Does this follow some sort of UPnP standard???

This is not an idle musing, I’m chasing an error which might be something to do with this.

Thanks

Once again back to the reference books…
http://www.lua.org/manual/5.1/manual.html#2.1

I bet you’ll start hitting problems when you start trying to put characters that are special to HTTP (%), JavaScript ("), JSON () or HTML (&). Not that it will break cleanly; I bet & will survive the Luup engine but break on display in the web UI.

@Brientim had the right answer for the question … but I am assuming that this was not the right question. LUA will fail to compile your statement if the variable name is wrong.

@futzle was referring the luup.variable_set or device state variables.
The basic device state variables software that runs in VERA probably does not care anything about what the name is. I am sure the names are looked at using a hash table or a string comparison. However that data is passed to many other components (as xml or json) … and then presented to user interface (html) and they may have problems.

If you followed the rules for real LUA variable names … you will be in good shape for all of these other layers.

[quote=“Brientim, post:2, topic:176787”]Once again back to the reference books…
http://www.lua.org/manual/5.1/manual.html#2.1[/quote]
No,no, you can’t throw that one at me!
I know PiL v3 and the reference manual back to front.
The question was Luup, not Lua!

…and that, indeed, was the meaning of my rather poorly posed question. I should also make it clear that it’s not simply perversion which leads me to possibly bizarre variable names, but the fact that they are constructed from free text set elsewhere by A.N.Other, so I need to filter out the dross.

The basic device state variables software that runs in VERA probably does not care anything about what the name is. I am sure the names are looked at using a hash table or a string comparison.
...a fair guess.
However that data is passed to many other components (as xml or json) ... and then presented to user interface (html) and they may have problems.
...which takes us back to @futzle's advice.
If you followed the rules for real LUA variable names ... you will be in good shape for all of these other layers.
...a conservative approach which is probably also GOOD ADVICE and in line with @Brientim.

I kind of hoped that it might be defined somewhere. Silly me.

Thanks all.

If MCV decided to adhere to the UPnP spec for rules regarding variable names, then the answer can be found in the file documents/UPnP_Service_Checklist1.01.pdf in the upnpresources.zip file available from [url=http://upnp.org/resources/upnpresources.zip]http://upnp.org/resources/upnpresources.zip[/url].

It says:

____ 3. State Variable names are compliant with UPnP naming conventions a) Are descriptive of the state variable?s function, < 32 Characters b) Capitalize the first letter of each word used in the name c) Do not use reserved prefixes (X_ or A_ ) except as intended

Thanks for that @watou

I’ve always fallen asleep wading through the UPnP documents before finding the relevant bit…