Page 1 of 1

esp8266 NodeMCU lua html

Posted: Mon Mar 10, 2025 5:10 pm
by johndoe71rus
Try to update old project esp8266 NodeMCU lua bme280. oddities with the if elseif construct. html code is corrupted.
Old version works on NodeMCU 2.2. New version on 3.0. project based on web-server https://github.com/bondrogeen/web-server

code example

Code: Select all

	<table>
   <thead>
    <tr>
     <th>sensor</th>
     <th><?lua if bmx280.mode == 1 then return("bmp280") elseif bmx280.mode == 2 then return("bme280") else return("no device") end ?></th>
    </tr>
   </thead>
   <tbody>
    <tr>
     <td>temperature</td>
     <td><?lua return(bmx280.temp) ?>&nbspC</td>
    </tr>
    <tr>           
comparison of the source and the code received by the browser in the picture
but if you shorten the " if elseif " then there is no damage

Code: Select all

<th><?lua if bmx280.mode == 1 then return("bmp280") elseif bmx280.mode == 2 then return("bme280") end ?></th>