2--! @
short Read Eval Print Loop
3--! @brief an interpreter to debuging the
game via stdio.
4--! @par Extended Backus-Naur Form
6--!
line =
exit | frame_skip | [frame_skip], variable, [
"=", value (* assignment *)];
7--! frame_skip = [digit],
"!" ;
8--! digit = { ? 0 - 9 ? }- ;
27 local frames,
line = line_src:match('(%d+)!(.*)')
31 frames,
line = line_src:match('(!)(.*)')
32 if frames and
line then
39 local variable, assignment =
line:match('(.*)=(.*)')
40 if variable and assignment then
41 return variable, assignment
49 if assign and
#assign > 0 then
50 script =
'return function(std, game, application)\n'..var..
'=('..assign..
')\n return ('..var..
')\nend'
51 elseif var and #var > 0 then
52 script =
'return function(std, game, application)\nreturn ('..var..
')\nend'
55 if script and #script > 0 then
56 local
ok, output = pcall(function()
57 local func, err =
load(script)
66 return ok, tostring(output)
94 local
ok,
line = pcall(io.read)
102 frames = tonumber(frames)
108 io.stderr:write(output)
117 while index <= frames do
129if not
package.loaded['modulename'] then
local function file(self, file)
local function require(std, game, application)
local function loadgame(game_file)
safe load game
local function package(self, module_name, module, custom)
local function exit(self)
local function error(self, handler_func)
local function draw(std, game)
local function http(std, game)
local function init(args)
local application_default
local function line_skip_frames(line_src)
local function evaluate(var, assign, std, game, application)
local function line_assignment(line)
local function line(x1, y1, x2, y2)
local function loop(std, game, application, dt)
local function fps(self, show, x, y)