modified implementation of lua-console