lua-users home
lua-l archive

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

On Thu, Jan 13, 2000 at 05:45:11AM -0200, Adolf Mathias wrote:
> From what I heard, Vicious Basic supports the loading and accessing
> of DLL's, so maybe it is even enough to compile Lua as a DLL and
> access that from VB, or if that's not possible directly, write an
> intermediate DLL that exports the necessary features of Lua
> (dostring, pushnumber/string..., lua_lua2C, you certainly know them
> all) to VB. 

It would be pretty easy to just load a standard lua DLL into VB and
call into it. It really depends how much interoperation you want.

> The key seems to be what C data types can be accessed
> (read and written) from VB and how the invocation of C functions
> works. I imagine that it happens with some sort of stack, like in
> Lua. Can't help you with the details though...

VB is static typed and is actually very close to C in many ways. The
argument passing convention is just like C. Even the datatypes can
mostly be mapped directly. OCXs (vb controls) are COM/OLE
objects. Paul Bleisch did some stuff a while back so that Lua could
load and talk to COM objects via a type-library. I don't know how far
along it was.

What is it you want to do? I see a few different options:

1) Write your App in VB, while using Lua for some simple scripting and
   config file stuff. 

   Solution: Compile Lua as a DLL, import the DLL functions into
    VB, and hack away.

2) Write your App in Lua, using VB controls.

   Solution: Find one of these COM interfaces, and use the COM controls
    to make your app go. You'll have to write some windows event loop
    handling code, but this should be doable. You won't be able to use
    the VB dev environment at all.

3) Write your App in VB, with Lua talking back to it in complicated ways.

   Solution: Do #1. Then you'll have to experiment with registering a
    VB function as a Lua C-function. I think it should work just fine.
    Then you can write your call-back functions in VB, and you should
    be set.

David Jeske (N9LCA) + +