There are some very nice loadable extensions for Lua 5,
like lposix. Unfortunately, out of the box SciTE doesn't
enable loadlib.

 Here is a patch:
1) comment out the #if PLATWIN and #endif lines
at src/ LuaExtension.cxx,1371 so that luaopen_loadlib
will be called
2) add the line #define USE_DLOPEN at the top of
lua/src/lib/loadlib.c to force dlopen to be used.
3) add the link flag -Wl,-export-dynamic
to the link command in the makefile.
(I added this directly to the line 106)

The last isn't strictly necessary to get loadlib going,
but you need it to expose the Lua API so that
Lua extensions can load; otherwise you can only
load plain libraries which can only supply a single
entry point to be called.  The SciTE binary
will be larger however (about 30%)

Here (for example) is how to get lposix loaded.
Go to http://www.tecgraf.puc-rio.br/~lhf/ftp/lua
and grab the lposix source; untar it and modify
Makefile so that the variable LUA points to
<scite-source>/lua. The build will  not
entirely succeed, but you will be left with a 
working lposix.so.

In a SciTE script, you can now say

init = loadlib('<full-path>/lposix.so','luaopen_posix')
if init then
  init()
end

and useful functions like posix.getcwd(), etc will be
available! Unfortunately, the source is the only
documentation :(

steve d.

(It would be really cool if this could go into 1.72, but
it needs to be tested more!)




-- 
This message is subject to the CSIR's copyright, terms and conditions and
e-mail legal notice. Views expressed herein do not necessarily represent the
views of the CSIR.
 
CSIR E-mail Legal Notice
http://mail.csir.co.za/CSIR_eMail_Legal_Notice.html 
 
CSIR Copyright, Terms and Conditions
http://mail.csir.co.za/CSIR_Copyright.html 
 
For electronic copies of the CSIR Copyright, Terms and Conditions and the CSIR
Legal Notice send a blank message with REQUEST LEGAL in the subject line to
[EMAIL PROTECTED]


This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.

_______________________________________________
Scite-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scite-interest

Reply via email to