Added more Lua testing code.
This commit is contained in:
parent
64b54dd697
commit
3e753c07d4
1 changed files with 8 additions and 14 deletions
22
lua/test.lua
22
lua/test.lua
|
|
@ -5,28 +5,22 @@ permalink: /cgi/lua/test.lua
|
|||
package.path = '{{ site.libdir }}/lua/?.lua;' .. package.path
|
||||
|
||||
require('xw3.http')
|
||||
--require('xw3.session')
|
||||
|
||||
--[=====[
|
||||
A multiline comment...
|
||||
https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies
|
||||
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers
|
||||
https://developer.mozilla.org/en-US/docs/Glossary/Request_header
|
||||
https://developer.mozilla.org/en-US/docs/Glossary/Response_header
|
||||
--]=====]
|
||||
|
||||
math.randomseed(os.time())
|
||||
math.random(); math.random(); math.random()
|
||||
|
||||
print('Cache-control: no-cache')
|
||||
print('Pragma: no-cache')
|
||||
print('Set-Cookie: HANNES=HANNES; expires=Mon, 17-Jul-2055 16:06:00 GMT; Max-Age=31449600; Path=/; secure')
|
||||
print('Set-Cookie: KEY='..math.random()..'; expires=Mon, 17-Jul-2055 16:06:00 GMT; Max-Age=31449600; Path=/; secure')
|
||||
print('Content-type: text/plain; charset=utf-8')
|
||||
print()
|
||||
|
||||
--print(os.getenv("HTTP_COOKIE"))
|
||||
--print()
|
||||
--print(package.path)
|
||||
--print()
|
||||
--print(max(1, 10))
|
||||
--print()
|
||||
--print("Hello from Lua!")
|
||||
--print()
|
||||
--print(os.getenv("HTTP_COOKIE"))
|
||||
--print()
|
||||
print(os.execute('/usr/bin/env | /usr/bin/sort'))
|
||||
print()
|
||||
--print(debug.traceback("Stack trace"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue