mirror of
https://github.com/TangentFoxy/lovebird.git
synced 2025-07-28 11:02:19 +00:00
Moved local loadstring -> lovebird.loadstring
This commit is contained in:
@@ -11,6 +11,7 @@ local socket = require "socket"
|
|||||||
|
|
||||||
local lovebird = { _version = "0.1.0" }
|
local lovebird = { _version = "0.1.0" }
|
||||||
|
|
||||||
|
lovebird.loadstring = loadstring or load
|
||||||
lovebird.inited = false
|
lovebird.inited = false
|
||||||
lovebird.host = "*"
|
lovebird.host = "*"
|
||||||
lovebird.buffer = ""
|
lovebird.buffer = ""
|
||||||
@@ -25,12 +26,14 @@ lovebird.whitelist = { "127.0.0.1", "192.168.*.*" }
|
|||||||
lovebird.maxlines = 200
|
lovebird.maxlines = 200
|
||||||
lovebird.updateinterval = .5
|
lovebird.updateinterval = .5
|
||||||
|
|
||||||
|
|
||||||
lovebird.pages["index"] = [[
|
lovebird.pages["index"] = [[
|
||||||
<?lua
|
<?lua
|
||||||
-- Handle console input
|
-- Handle console input
|
||||||
if req.parsedbody.input then
|
if req.parsedbody.input then
|
||||||
local str = req.parsedbody.input
|
local str = req.parsedbody.input
|
||||||
xpcall(function() assert(loadstring(str, "input"))() end, lovebird.onerror)
|
xpcall(function() assert(lovebird.loadstring(str, "input"))() end,
|
||||||
|
lovebird.onerror)
|
||||||
end
|
end
|
||||||
?>
|
?>
|
||||||
|
|
||||||
@@ -361,8 +364,6 @@ lovebird.pages["env.json"] = [[
|
|||||||
]]
|
]]
|
||||||
|
|
||||||
|
|
||||||
local loadstring = loadstring or load
|
|
||||||
|
|
||||||
|
|
||||||
function lovebird.init()
|
function lovebird.init()
|
||||||
-- Init server
|
-- Init server
|
||||||
@@ -391,7 +392,7 @@ function lovebird.template(str, params, chunkname)
|
|||||||
local f = function(x) return string.format(" echo(%q)", x) end
|
local f = function(x) return string.format(" echo(%q)", x) end
|
||||||
str = ("?>"..str.."<?lua"):gsub("%?>(.-)<%?lua", f)
|
str = ("?>"..str.."<?lua"):gsub("%?>(.-)<%?lua", f)
|
||||||
str = "local echo " .. params .. " = ..." .. str
|
str = "local echo " .. params .. " = ..." .. str
|
||||||
local fn = assert(loadstring(str, chunkname))
|
local fn = assert(lovebird.loadstring(str, chunkname))
|
||||||
return function(...)
|
return function(...)
|
||||||
local output = {}
|
local output = {}
|
||||||
local echo = function(str) table.insert(output, str) end
|
local echo = function(str) table.insert(output, str) end
|
||||||
|
Reference in New Issue
Block a user