VBBR |
Posted - May 01 2004 : 6:15:08 PM Is there any ready wrapper/code/module/whatever that makes it possible to use Lua with Visual Basic?
Because today I just started working on one, so I must know if it already exists, as I won't want to lose much time reinventing the wheel. |
Sion |
Posted - Feb 11 2005 : 09:43:36 AM quote: Originally posted by Eric Coleman
If the "Lua.NET" stuff isn't going to work for you, (I've never looked at it myself), then I'm not sure how to safely impliment a Lua engine in a .NET program.
LuaPlus actually also work with VB .NET, I haven't tried it though. Here's a quote from the LuaPlus features page:
quote: The .NET version of LuaPlus opens up LuaPlus's features to any .NET based language. This includes C#, Visual Basic, Python, Perl, and others.
|
Eric Coleman |
Posted - Feb 09 2005 : 10:13:03 PM To get Lua to work in Classic VB, versions 5 or 6, you would need to create a proxy DLL in C. With a C proxy dll you can use callbacks in VB that respond to events in Lua. I'm no expert on VB.NET, but I'm not sure if something like that is even possible. Does VB.NET allow you to pass function pointers to unmanaged code? If you insist on using C++, then you should use LuaPlus. And if you go the C++ route you could always create a COM dll, but COM doesn't work very well with .NET, so you can still run into weird problems. If the "Lua.NET" stuff isn't going to work for you, (I've never looked at it myself), then I'm not sure how to safely impliment a Lua engine in a .NET program. |
Mikey |
Posted - Feb 09 2005 : 9:38:56 PM Hey there, did you ever finish this? -- Would you like to share it? -- I'm making a c project that will use LUA, but I plan on having the editor in VB -- right now I need LUA in vb.net -- I noticed a LUA.NET project, but this seems to be something different than having a scripting language avilable -- My progress so far has been to create a class library (a dll) in C++ that will directly interact with LUA, and then VB can interact with my class -- I'm just checking that I'm not reinventing the wheel myself -- this seems to be the only link that "LUA" "VB" has popped up on google for me, also. |
Eric Coleman |
Posted - May 02 2004 : 7:00:52 PM A "void *" is a generic pointer, so yes, the VB declaration would be ByRef As Any, or you could use a xxxPtr function declare it as ByVal As Any. If a function's return type is declared as void, then it would be a Sub instead of a Function. |
VBBR |
Posted - May 02 2004 : 5:13:06 PM I'm using VC++ 7 (VS.NET 2003) and compiling it into a normal DLL. (stdcall)
I think I need to work more with the API directly in C++ to understand it better... For example, some parameters that are declared as "void" in the header but have some use, and I *think* they should be declared as "Any" in VB. |
Eric Coleman |
Posted - May 02 2004 : 4:10:22 PM What compiler are you using for the C code? Are you compiling it into a regular DLL or a COM DLL? |
Dan |
Posted - May 02 2004 : 2:58:52 PM here is a good tutorial for the control (named msscript.ocx)
http://www.thescarms.com/VBasic/Scripting.asp
|
Spodi |
Posted - May 02 2004 : 2:09:19 PM Yeah, there's plenty of scripting languages, VBScript is probably one of the greater ones though. There's also a bunch on PSCode if you want to find one then modify it to your liking. |
VBBR |
Posted - May 02 2004 : 1:51:38 PM I mean creating a wrapper, like "Public Declare Function lua_open" blah blah with the needed adjustments...
For now just the _open function works without crashing everything, even the _close crashes...
I will take a look at this Control you said... |
Eric Coleman |
Posted - May 02 2004 : 1:17:55 PM If you need a pre-made scripting engine, there is always the Microsoft Scripting Control, which allows you to use either VBScript or Microsoft's version of JavaScript which is JScript.
When you say that you're trying to "port it to VB," are you creating a wrapper for it or are you trying to re-write all of the C code in VB? |
VBBR |
Posted - May 02 2004 : 11:59:27 AM I'm also new with Lua, but as I'm not good with C/C++ I'm trying to port it to VB (what I think I know how to do).
quote: also had you considered creating a custom script or the use of VB scripting?
Do you mean create a scripting language from scratch / using VBScript?
I even thought about it, but Lua seemed easier as it is already done... Also it's very well known for games. |
Dan |
Posted - May 02 2004 : 10:54:23 AM I can't see that lua has a visual basic wrapper, reading the lua user group site, there are plenty of tools for C but none for VB.
http://lua-users.org/wiki/LuaAddons
There is an lua IRC channel @ irc.freenode.net/lua maybe someone there can point you in the correct direction.
I havn't heard of Lua until now - would be interested to know how you get on with it - also had you considered creating a custom script or the use of VB scripting?
|
VBBR |
Posted - May 02 2004 : 09:04:48 AM OK then, I guess an OO approach is (almost) always good. So I will make it with classes.
(just one more thing, it's Lua and not LUI ) |
Eric Coleman |
Posted - May 01 2004 : 9:18:59 PM I can't really give my opinion, I don't know what the API for LUI is like. If what you create works, then that's all that matters |
VBBR |
Posted - May 01 2004 : 8:34:21 PM I looked but couldn't refine the search well...
"lua" "visual basic"
gave me kinda 7,000 results...
"lua with visual basic" gave me zero...
I guess I will code the wrapper myself then.
BTW, I'm even thinking of implementing it with classes, what do you think? |