Skip to content
Snippets Groups Projects
Commit bd5c9d8f authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Kirill Yukhin
Browse files

box/console: Add mapping for direct symbols


Sole symbols (such as box.NULL) are not processed
by serpent "custom" symbols feature, since they
are not in table.

Thus we should process them separately. Without it
we have

 > require('console').set_default_output("lua,block")
 > ;
 > box.NULL
 > "cdata<void %*>: NULL";

instead of

 > box.NULL
 > box.NULL;

as it should be.

Part-of #3834

Reviewed-by: default avatarKonstantin Osipov <kostja.osipov@gmail.com>
Signed-off-by: default avatarCyrill Gorcunov <gorcunov@gmail.com>
(cherry picked from commit 6847367f)
parent 9dab5b4f
No related branches found
No related tags found
No related merge requests found
......@@ -40,12 +40,24 @@ output_handlers["yaml"] = function(status, opts, ...)
return internal.format({ error = err })
end
-- A map for internal symbols in case if they
-- are not inside tables and serpent won't be
-- able to handle them properly.
local lua_map_direct_symbols = {
[box.NULL] = 'box.NULL',
}
output_handlers["lua"] = function(status, opts, ...)
--
-- Don't print nil if there is no data
if not ... then
return ""
end
for k,v in pairs(lua_map_direct_symbols) do
if k == ... then
return v
end
end
--
-- Map internal symbols which serpent doesn't know
-- about to a known representation.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment