I am using LuaLaTeX with LuaSQL and I have two files which are test.tex and test.lua. When I compile with lualatex test.tex, first test.lua is ran and it reads user values from my database for rows where variable id_user = 3. This variable is set inside test.lua.
So currently every compilation returns values for same user, but I would like to pass user ID at compile time as an argument, like:
lualatex test.tex 2399 This would be for user with id_user = 2399. So the problem here is that I have to pass values to lualatex and not lua itself! How can this be done? Can anyone provide a MWE?

lualatex doc.tex. Surely, the.texfile processing must begin first?