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

box/console: Relax lua handler from local variables


This allows lua to not create them every call since
they are constant speeding up processing a bit.

Part-of #3834

Reviewed-by: default avatarKonstantin Osipov <kostja.osipov@gmail.com>
Signed-off-by: default avatarCyrill Gorcunov <gorcunov@gmail.com>
parent 6847367f
No related branches found
No related tags found
No related merge requests found
......@@ -47,6 +47,23 @@ local lua_map_direct_symbols = {
[box.NULL] = 'box.NULL',
}
-- A map for internal symbols in case if they
-- are coming from tables and we need to depict
-- them into user known values.
local lua_map_table_symbols = {
['"cdata<void %*>: NULL"'] = 'box.NULL'
}
--
-- Map internal symbols which serpent doesn't
-- know about to a known representation.
local serpent_map_symbols = function(tag, head, body, tail, level)
for k,v in pairs(lua_map_table_symbols) do
body = body:gsub(k, v)
end
return tag..head..body..tail
end
output_handlers["lua"] = function(status, opts, ...)
--
-- Don't print nil if there is no data
......@@ -58,20 +75,8 @@ output_handlers["lua"] = function(status, opts, ...)
return v
end
end
--
-- Map internal symbols which serpent doesn't know
-- about to a known representation.
local map_symbols = function(tag, head, body, tail, level)
local symbols = {
['"cdata<void %*>: NULL"'] = 'box.NULL'
}
for k,v in pairs(symbols) do
body = body:gsub(k, v)
end
return tag..head..body..tail
end
local serpent_opts = {
custom = map_symbols,
custom = serpent_map_symbols,
comment = false,
nocode = true,
}
......
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