Re: variables with a space in them
Spar <[email protected]> Mon, 13 Jul 2026 13:57:17 +0300
| Newsgroups | gmane.comp.lang.lua.general |
|---|---|
| Message-ID | <7f7bd695-f6f2-4c26-b5dc-beeca01894f9@Spark> |
--6a54c491_2e068c99_10be9
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
You can't. But you can either:
1. transform input to snake_case before making a variable (applicable only =
if generate Lua script by some other script)
2. Store them as string keys in the table. {["Key with spaces"] =3D "some v=
alue"}
Probably you don't even need to name them as variable names. Table will be =
fine.
On 13 Jul 2026 at 13:15 +0300, Ernestyna <[email protected]>, wrote:
> hello!
>
> at first, i'd like to say i have no experience with lua coding nor know h=
ow it works. i am an admin on a fandom wiki so i guess my coding skills onl=
y come to some limited html expressions. so sorry if i use some incorrect w=
ording!
>
> yesterday i decided to implement a new module to our wiki called Line dis=
tributions. basically, it just shows a ranking of the group's members based=
on how much they sang in a song. it uses local groups with members to work=
properly where some of the members have a space in their name, e.g. "Kim L=
ip", "Go Won", or "Olivia Hye". it also uses another module, called Index=
=C2=A0to attribute each members their respective color. this is where my pr=
oblem arises. i cannot enter a variable with a space in it, otherwise the w=
hole code would break. temporarily, i have conjoined the two-worded names o=
f members as this feature is still in a testing phase so it wouldn't make m=
uch of a difference for the admins anyway. so my question is=E2=80=94is it =
possible to make a variable with a space in it? i have tried adding an unde=
rscore or a plus symbol, even an invisible special symbol, however none of =
these seem to work like i'd like to.
>
> i'm looking forward to your response. if you wish to see how the module w=
orks, you can see it in my sandbox page. feel free to edit anything too, lo=
l. there are some other few issues but i'll come back to these later. thank=
you so much!!!
> --
> You received this message because you are subscribed to the Google Groups=
"lua-l" group.
> To unsubscribe from this group and stop receiving emails from it, send an=
email to [email protected].
> To view this discussion visit https://groups.google.com/d/msgid/lua-l/CA%=
2Bgg%2B6Y061y-fWiS4-cOeDKa3NnE6tBPmm%2BsDpgJ9qyK_3wqag%40mail.gmail.com.
--=20
You received this message because you are subscribed to the Google Groups "=
lua-l" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/lua-l/7f7bd=
695-f6f2-4c26-b5dc-beeca01894f9%40Spark.
--6a54c491_2e068c99_10be9
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
<html xmlns=3D"http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<div name=3D"messageBodySection">
<div>You can't. But you can either:</div>
<ol type=3D"1">
<li>transform input to snake_case before making a variable (applicable only=
if generate Lua script by some other script)</li>
<li>Store them as string keys in the table. {["Key with spaces"] =3D "some =
value"}</li>
</ol>
<div> </div>
<div>Probably you don't even need to name them as variable names. Table wil=
l be fine.</div>
</div>
<div name=3D"messageReplySection">On 13 Jul 2026 at 13:15 +0300, Ernestyna =
<[email protected]>, wrote:<br />
<blockquote type=3D"cite">
<div dir=3D"ltr">
<div>hello!</div>
<div><br /></div>
<div>at first, i'd like to say i have no experience with lua coding nor kno=
w how it works. i am an admin on a fandom wiki so i guess my coding skills =
only come to some limited html expressions. so sorry if i use some incorrec=
t wording!</div>
<div><br /></div>
<div>yesterday i decided to implement a new module to our wiki called <a hr=
ef=3D"https://loonatheworld.fandom.com/wiki/Module:LD">Line distributions</=
a>. basically, it just shows a ranking of the group's members based on how =
much they sang in a song. it uses local groups with members to work properl=
y where some of the members have a space in their name, e.g. "Kim Lip", "Go=
Won", or "Olivia Hye". it also uses another module, called <a href=3D"http=
s://loonatheworld.fandom.com/wiki/Module:Index">Index</a> to attribute=
each members their respective color. this is where my problem arises. i ca=
nnot enter a variable with a space in it, otherwise the whole code would br=
eak. temporarily, i have conjoined the two-worded names of members as this =
feature is still in a testing phase so it wouldn't make much of a differenc=
e for the admins anyway. so my question is=E2=80=94is it possible to make a=
variable with a space in it? i have tried adding an underscore or a plus s=
ymbol, even an invisible special symbol, however none of these seem to work=
like i'd like to.</div>
<div><br /></div>
<div>i'm looking forward to your response. if you wish to see how the modul=
e works, you can see it in <a href=3D"https://loonatheworld.fandom.com/wiki=
/User:Dysharmonia/Sandbox">my sandbox page</a>. feel free to edit anything =
too, lol. there are some other few issues but i'll come back to these later=
. thank you so much!!!</div>
</div>
<p></p>
--<br />
You received this message because you are subscribed to the Google Groups "=
lua-l" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:[email protected]">lua-l+unsubsc=
[email protected]</a>.<br />
To view this discussion visit <a href=3D"https://groups.google.com/d/msgid/=
lua-l/CA%2Bgg%2B6Y061y-fWiS4-cOeDKa3NnE6tBPmm%2BsDpgJ9qyK_3wqag%40mail.gmai=
l.com?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.com=
/d/msgid/lua-l/CA%2Bgg%2B6Y061y-fWiS4-cOeDKa3NnE6tBPmm%2BsDpgJ9qyK_3wqag%40=
mail.gmail.com</a>.<br /></blockquote>
</div>
</body>
</html>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;lua-l" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:[email protected]">lua-l+unsubsc=
[email protected]</a>.<br />
To view this discussion visit <a href=3D"https://groups.google.com/d/msgid/=
lua-l/7f7bd695-f6f2-4c26-b5dc-beeca01894f9%40Spark?utm_medium=3Demail&utm_s=
ource=3Dfooter">https://groups.google.com/d/msgid/lua-l/7f7bd695-f6f2-4c26-=
b5dc-beeca01894f9%40Spark</a>.<br />
--6a54c491_2e068c99_10be9--