[Openmcl-devel] nonglobal ffi callbacks?

Michael Kohout mwkohout at gmail.com
Thu Aug 13 08:46:18 PDT 2009

Hmm. Your way is much better....

This morning I facepalmed over my bran flakes-I realized I could just
declare the user data needed by the plugins dynamic-

(defcallback sayHello :int ((state :pointer))
         (declare (special *message*))
         (let ((args (lua_gettop state)))
           (print (format nil "Hello from Lua.  Argcount:~A Message:~A" args

This form registers and calls the callback
(let ((*message* "I'm dynamic"))
  (declare (special *message*))
  (lua_register *lua-state* "hello" (callback sayhello))
  (lua_loadbuffer *lua-state* "hello(1)" (length "hello(1)" ) "line" )

  (lua_pcall *lua-state* 0 0 0 ))

Prints out:"Hello from Lua.  Argcount:1 Message:I'm dynamic"

But your way is more general....thanks a bunch
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.clozure.com/pipermail/openmcl-devel/attachments/20090813/f240aaee/attachment.htm>

More information about the Openmcl-devel mailing list