Is it valid in lua to call for unexisting key’s values of a table?

|
Ceda EI 2022-07-23 22:59:33
Since we were talking about groff
Ceda EI 2022-07-23 22:59:34
Writing my PhD using groff (Score: 153+ in 7 hours)

Link: https://readhacker.news/s/5hnzt
Comments: https://readhacker.news/c/5hnzt

Joshua Stutterjstutter.netlify.app
A Blog about Joshua Stutter’s PhD
Jamerive 2022-07-24 02:39:28
Ceda EI 2022-07-23 22:59:33
Since we were talking about groff

What is groff?

moogiwaraa 2022-07-24 03:25:19
Jamerive 2022-07-24 02:39:28
What is groff?

GroffΒ (GNU troff) is a typesetting system that reads plain text mixed with formatting commands and produces formatted output. Output may be PostScript or PDF, html, or ASCII/UTF8 for display at the terminal.

https://www.gnu.org/software/groff/

smol_mazunki 2022-07-24 03:41:44
Jamerive 2022-07-24 02:39:28
What is groff?

manpages’ source code 😎

Shah_baaz2 2022-07-24 06:15:17
Carlo Chech 2022-07-22 16:31:15
usermod -aG docker $USER

Yes, i will give it a try on Monday

prabha3215 2022-07-24 09:36:21
Jh Ony:
I have a string like this
newbode-5679.xml.bzip2.html

I want to the extract all the strings before the “.html” extension

prabha3215 2022-07-24 09:36:32
Can anyone help me on this
marcotrosi 2022-07-24 09:47:32
prabha3215 2022-07-24 09:36:21
Jh Ony:
I have a string like this
newbode-5679.xml.bzip2.html

I want to the extract all the strings before the “.html” extension

you wanna use grep or is it inside a bash script?

marcotrosi 2022-07-24 09:47:43
are the strings in a file or in a variable?
marcotrosi 2022-07-24 09:47:57
we need a bit more context
marcotrosi 2022-07-24 09:50:41
prabha3215 2022-07-24 09:36:32
Can anyone help me on this

~ ❯ var=’newbode-5679.xml.bzip2.html’
~ ❯ echo ${var%.html}
newbode-5679.xml.bzip2
~ ❯

marcotrosi 2022-07-24 09:51:44
I now just assumed you were talking about variables
marcotrosi 2022-07-24 09:52:47
but there some more ways
marcotrosi 2022-07-24 10:02:52
echo ${var%.html}
echo ${var:0:(-5)}

echo `expr “$var” : ‘(.*).html$’`
echo $(expr “$var” : ‘(.*).html$’)

marcotrosi 2022-07-24 12:31:41
marcotrosi 2022-07-24 10:02:52
echo ${var%.html}
echo ${var:0:(-5)}

echo `expr “$var” : ‘(.*).html$’`
echo $(expr “$var” : ‘(.*).html$’)

for whatever reason I’m not able to make it work with “expr match”

prabha3215 2022-07-24 13:16:56
marcotrosi 2022-07-24 09:50:41
~ ❯ var=’newbode-5679.xml.bzip2.html’
~ ❯ echo ${var%.html}
newbode-5679.xml.bzip2
~ ❯

Thank you so much it works fine

Captn_Obvious 2022-07-24 23:27:20
marcotrosi 2022-07-24 10:02:52
echo ${var%.html}
echo ${var:0:(-5)}

echo `expr “$var” : ‘(.*).html$’`
echo $(expr “$var” : ‘(.*).html$’)

less elegant, but still working:

echo “$var” | sed s/.html$//g

smol_mazunki 2022-07-25 00:11:18
this is probably a lua question more than anything
smol_mazunki 2022-07-25 00:11:51
unixusergroup-47893.jpg
i’m setting up my neovim config, and i’m thinkking it’s dumb to have redundant .setup() lines
smol_mazunki 2022-07-25 00:12:36
is it valid in lua to call for unexisting key’s values of a table?
smol_mazunki 2022-07-25 00:13:19
so i could set cmd = myopts_cmds[lsp]
smol_mazunki 2022-07-25 00:18:55
unixusergroup-47896.jpg
looks like it works fine πŸ™‚
marcotrosi 2022-07-25 08:28:49
smol_mazunki 2022-07-25 00:11:18
this is probably a lua question more than anything

but why not in the Vim group?

n0madcoder 2022-07-25 14:21:00
unixusergroup-47898.jpg
Does anyone know which editor is this one?
marcotrosi 2022-07-25 14:23:02
I can tell it’s not Vim
n0madcoder 2022-07-25 14:51:05
Midnight commander’s coolEdit
n0madcoder 2022-07-25 14:51:46
Thanks to the search I’ve found devc++ and turboc ones, sadly the first one is only aimed for windows machines
smol_mazunki 2022-07-25 14:58:53
marcotrosi 2022-07-25 08:28:49
but why not in the Vim group?

cuz even though the context was nvim, the question was about lua

smol_mazunki 2022-07-25 14:59:01
but either would work i guess
smol_mazunki 2022-07-25 14:59:49
n0madcoder 2022-07-25 14:51:46
Thanks to the search I’ve found devc++ and turboc ones, sadly the first one is only aimed for windows machines

how old are these editors? πŸ€”

marcotrosi 2022-07-25 15:02:49
smol_mazunki 2022-07-25 00:12:36
is it valid in lua to call for unexisting key’s values of a table?

you will get nil

marcotrosi 2022-07-25 15:02:58
unless you use a metatable
marcotrosi 2022-07-25 15:03:30
t={}
print(t.foo)
prints nil
n0madcoder 2022-07-25 15:04:29
smol_mazunki 2022-07-25 14:59:49
how old are these editors? πŸ€”

Soviet union era hehe. But they look so cool

|