Open chowette opened 4 years ago
I agree with you about file location and separation. However, Webserver script pages are not lua scripts, they are html files with some part containing lua fragment of script. It is not uncommon to have lua statement split and interleaved with 'raw text'. It this case, most editor with syntactic coloration cannot display the file as lua.
Compare
<html>
<body>
<table>
<?lua for i=1,10 do ?>
<tr><td> <?lua print(i) ?></td></tr>
<?lua end ?>
</table>
</body>
</html>
to
<html>
<body>
<table>
<?lua for i=1,10 do ?>
<tr><td> <?lua print(i) ?></td></tr>
<?lua end ?>
</table>
</body>
</html>
If both files have, the same extension, is it way harder to instruct your editor how to colorise the file.
Finally, there is no sense in doing dofile('index.lua')
but you cannot do dofile('index.luasp')
[[ ]]
for raw string embedding This allow us to not track string quotes and output bigger chunk. The downside is that we are more likely to hit the buffer size limit of 2k, and miss a lot of preallocated buffer use. So we need to track the length of the line and break. This change also preserve blank line in raw text..luasp
for lua server pages Avoid confusion with real lua file, and allow editor highlighting based on extension Note that preprocessed file end up with extension.luaspp
<?lua= expression ?>
In any case, your lua code should not include the ending tag so
<?lua print('?>') ?>
is malformed and should be rewritten by hand to<?lua print('?'..'>') ?>
for exemple.