Re: [ANNOUNCE] LTN 4 - A thin API for interlanguage working

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Re: [ANNOUNCE] LTN 4 - A thin API for interlanguage working

Jean-Claude Wippler
On Fri, Feb 9, 2001, Luiz Henrique de Figueiredo <[hidden email]>


Thank you and Reuben Thomas very much for sharing this.  Having gotten a
preview a few days ago, it already helped me create simple wrappers for
Tcl and Python.  Early/rough (but working) source and binaries for this
are at

It turns out to be possible to avoid a special register function by
implementing argument passing and a special "callback" argument.  The
argument mechanism also reduces the need to pass scripts around and
compile them on each call.


P.S. A Python example from

  #!/usr/bin/env python

  # An example of the Python <-> Lux binding
  # 09/02/2001 [hidden email]

  import pylux

  # Shorthand to run a Lua script with "lux('script')"
  def lux(script):
    pylux.eval("gv", "dostring", script)

  # Shorthand to define a Python proc as callback for Lua
  def luxcb(name,func):
    pylux.eval("gvc", "setglobal", name, func)

  luxcb("luxAppend", luxGlobals.append)
    for i,v in globals() do
  print luxGlobals

Note: the first arg to pylux.eval is a string with characters describing
the types of the remaining arguments: g=global, v=value, c=callback.