fengari-lua / fengari-web

Provides everything you need to run Fengari in the browser.
MIT License
250 stars 19 forks source link

Loading Pure Lua Crypto causes XML warning #41

Closed RussellHaley closed 5 years ago

RussellHaley commented 5 years ago

Hi, I'm loading Pure Lua Crypto into my client. It seems to be working but I get a warning so I thought I'd bring it to your attention:

XML Parsing Error: no root element found
Location: http://192.168.1.174:8099/lua/5.3/lua/plc/md5.lua
Line Number 1, Column 1: md5.lua:1:1
XML Parsing Error: no root element found
Location: http://192.168.1.174:8099/lua/5.3/lua/plc/md5/init.lua

Environment: fengari 1.4, Firefox 67 in GhostBSD (FreeBSD-CURRENT)

PLC files are found here: https://github.com/philanc/plc/tree/master/plc

Here is my client side lua script:

local js = require "js"
local window = js.global
local document = window.document
local md5 = require 'lua.plc.md5'

print("Document's title: " .. document.title)
print('Hello from Lua')
print('Testing md5: ' .. md5.hash('This is a test of plc'))
local ep = document:getElementById('endpoint')
document.title = 'heads up friends!'
if ep then ep.value = 'look at me ma!' end

Thanks for the cool library! Russ

daurnimator commented 5 years ago

What content-type is your web server serving md5.lua with?

RussellHaley commented 5 years ago

Ah, yes. I forgot I had hardcoded content types. My "web server" is a dirty hackup of one of your lua-http examples. (Facepalm!)