Conversation
lua has [[ ]] 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.
Avoid confusion with real lua file, and allow editor highlighting based on extension Note that preprocessed file end up with extension `.luaspp`
the0ne
left a comment
There was a problem hiding this comment.
System Lua scripts should not reside in the webserver directory.
Webserver Lua scripts should not reside outside of the webserver directory.
I don't see a benefit in adding another file extension.
|
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'. 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 |
lua has
[[ ]]for raw string embeddingThis 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.
.luaspfor lua server pagesAvoid 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.