lua-users home
lua-l archive

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


steve donovan wrote:
Hi all,

http://mysite.mweb.co.za/residents/sdonovan/lua/luajava.zip

This is a small Lua for Windows plugin that adds LuaJava plus some
interesting utilities. Just unzip into the LfW main directory, so that
things like luaj.exe sit next to lua.exe, etc. (If you don't use LfW,
then it should be straightforward anyway; the source is included)
[]
The `import` function works like the Java statement of the same name,
so that import 'java.lang.*' means that things like String, Integer,
etc will be brought into the global namespace.  As an extra
convenience, when classes are imported, a `__call` metamethod is
defined, so that you can simply create objects by calling the types,
e.g. `String("hello")`.

    > require 'java.import'
    > import 'java.lang.*'
    > s = String("hello")
    > print(s)
    hello

Looks great! Much more convenient than the all these exhausting calls to bindClass and new.

./Rolf