Hello
I run a webpage in my lua code that way :
function main ()
-- Lancement du serveur web
web.site[""] = web.compile(webpage.Page_Supervison_Enless)
web.start("*", 8080)
...
And the HTML code is into a lua variable.
I know how to display a lua variable in the webpage ( “<%=Var>” in html code) but now I need to generate dynamic variables.
The situation :
I receive frames from emitters with their ID (contained in Tab_Emetteur[l]) and when I recieved them (contained in Tab_Emetteur[j]).
Each time I receive a frame I generate a line in a HTML table :
li_Em = li_Em .. "<tr><td align=\"center\">" .. Tab_Emetteur[l] .. "</td><td align=\"center\">" .. Tab_Emetteur[j] .. "</td></tr>"
So I have a something like that
The left column with emitter IDs stay the same but I want to display when I recieved the last frame from each emitter. (Don’t mind the <%=Tab_Heure[<%=n>]>, I was a test and it didn’t work obviously…)
So I need to generate a variable when a new table line is created. And then when a frame is received, the time is updated in front of the right ID.
The number of emitter is not defined regarding where I run the program, that’s why creating a table with already X lines with X declared variables is not possible.
I tried something like that but I don’t know if it lead somewhere :
emetteur = {}
-- I receive a frame, I take its ID and time
ID = Tab_Emetteur[l]
time = Tab_Emetteur[j]
-- I add in my table a key = value to associate ID and time
emetteur.ID = time
-- li_Em = li_Em .. "<tr><td align=\"center\">" .. Tab_Emetteur[l] .. "</td><td align=\"center\">" .. emetteur.ID .. "</td></tr>"
In that way, I have variables like emetteur.11606534, emetteur.11324740 … Then I need to access those variable to change their associated values. But the use of emetteur.ID (or <%=emetteur.ID>) didn’t work.
Let me know if you need more details, it’s kinda hard to explain.
Thanks,
Dylan