Warning: this is an htmlized version!
The original is here, and
the conversion rules are here.
-- An executable introduction to the DaVinci project.
-- Latest version: http://angg.twu.net/DAVINCI/intro.lua
--       htmlized: http://angg.twu.net/DAVINCI/intro.lua.html
--   Project page: http://angg.twu.net/davinci.html   <- READ THIS!!!
-- Author:  Eduardo Ochs <eduardoochs@gmail.com>
-- Version: 2007jul18
-- Public domain.

-- DaVinci is an IDE for Lua based on SciTe, IUP, and Ldb.
-- See the project page (link above) for more information.
-- The main idea of this file is that if we put this in our 
-- ~/.SciTEUser.properties file,
--  
--   command.2.*=dostring dostring(editor:GetSelText())
--   command.name.2.*=lua-dostring
--   command.mode.2.*=savebefore:no
--   command.subsystem.2.*=3
--
-- then we can mark a region of text in SciTe, with, say,
-- shift-arrows, and when we press Ctrl-2 SciTe will execute
-- it in the Lua interpreter that it links in.
-- This is an e-script. The idea is the same as in:
--   http://angg.twu.net/eev-article.html
--
error('"intro.lua" is to be executed with lua-eval-region, not at once.')

-- Which version of Lua do we have?
-- SciTe 1.74 comes with Lua 5.1, older ones came with Lua 5.0.
print(_VERSION)          --> print: output in the output pane
io.write(_VERSION.."\n") --> io.write: output on stdout
io.flush()               --> flush stdout



-- (find-luamanualw3m "#pdf-file:setvbuf")
io.stdout:setvbuf("no")  --> make io.flush() unnecessary (Lua 5.1 only)
-- Load several convenience functions.

-- http://angg.twu.net/LUA/lua50init.lua.html
-- (find-angg "LUA/lua50init.lua")
dofile "lua50init.lua" 
sort = function (T) table.sort(T); return T end
HOME = os.getenv("HOME")


-- Send some commands to tcmd:
tcmd = function (tclcode)
    writefile("/tmp/ee.tcmd.tcl", tclcode)
    local output = getoutput("kill -USR2 $(cat /tmp/ee.tcmd.pid)")
    if output ~= "" then error(output) end
  end
tcmd("setfile fib.lua")
tcmd('setvars "n = 4\nN = 1"')
tcmd("setline 5")
tcmd("setline 6")


-- How do I list the functions in "editor"? It's a userdata...
PP(table.concat(sort(keys(_G)), " "))
print(editor)