lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Hi guys,

I have been messing around with the possibilities of custom Lua
interpreters. ilua offers a few things, like doing without '=' and
trying to print out table values inteligently:

$ lua ilua.lua
ILUA: Lua 5.1.2  Copyright (C) 1994-2007, PUC-Rio
"quit" to end
> s = {1,2,3}
> s
> m = {one=1,two=2}
> m
> 2*4
> for i=1,5 do print(i) end
> debug
{getupvalue=function: 003D9498,debug=function: 003D9328,sethook=function: 003D9
> ilua.print_handler('function',function(f) return 'fun' end)
> debug
> quit

ilua tries to decide if tables are 'list-like' or 'map-like'. Some
tables don't classify so neatly, so there is a way of switching off
this cleverness. The basic strategy is _experimental compilation_,
i.e. we first assume it's an expression, and if that fails, we try it
as a statement; this seems to work suprisingly well.

ilua offers an option to write user input and interpreter responses to
a transcript file. The default format for printing out floating poiint
numbers is settable, and one can completely customize how Lua types
are printed out using ilua.print_handler.

BTW, I have also posted a minimal readline binding (referenced in the
article), since interactive environments on Unix without it are

steve d.