- Sun Dec 07, 2014 5:36 am
#4175
I have been studying the source from adamjp in more detail. I've learned:
- many new tricks in Lua (having a 1-week experience in Lua, everything is "New")
- adamjp knows his coding, excellent.
Being curious and impatient I made some (small) changes to the source code, to eliminate some unwanted behavior (at least for me!).
Below the changes I made to the source code, and the changes I am intending to make, unless adamjp beats me to it (please do Adam
)
I have not uploaded the changed source code, I think that having only 1 baseline (adamjp's GITHUB) serves the community better. OK?
Code: Select allCHANGES made in init.lua (version dec 14, 2014)
[reason] luatool uploader tool raises an error when uploading init.lua, on the 1st char (space?) in the file
[change] deleted 1st char in file init.lua
[reason] want to use function docode also in the console, for testing, but it is defined as LOCAL
[action] removed LOCAL from function docode
[reason] need more debugging info while ongoin test
[action] added printing of full HTTP request
[action] added print statement in function sendfilecontents to print output to console too.
[reason] execution of .lua file is not implemented, I believe it was implemented in the 1st version?
[action] code added for execution code in .lua file, output of every line is going to the browser
Code: Select allINTENDED CHANGES
[reason] requests with params (like /GET test.pht?var1=„hello”&var2=„gerard”) are not supported, code is in source, but commented out]
[intended action] full request including params to be made available to .pht files for further processing in HTML/embedded-Lua. Not sure how I'm going to approach this, give me some inspiration, please!
[reason] multi-line embedded lua scripts in .pht files not supported
[intended action] support embedded multiline lua scripts in .pht files by offering docode NOT just 1 line but multiple lines. The idea is to replace the READLINE (in case of a <?lua line) by a series of READLINES to a string, and then pass this string to docode.
[reason] execution of .lua file and embedded Lua code in .pht files result in correct output, but is concluded with a CRLF? This becomes a blank line in the HTML to the browser, and this sometimes causes problems.]
[intended action] Changed the line in the code to suppress the \n at the end of the output.. Commented it out for now, need some further testing to ensure that it creates no other problems.