Post

 Resources 

Console

Home | Profile | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 VBGamer
 VBGamer
 Lua with VB
 New Topic  Reply to Topic
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 2

VBBR
Moderator

Brazil
617 Posts

Posted - May 01 2004 :  6:15:08 PM  Show Profile  Reply with Quote
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.

Whatever. Who knows...

Eric Coleman
Gladiator

USA
811 Posts

Posted - May 01 2004 :  8:20:25 PM  Show Profile  Visit Eric Coleman's Homepage  Reply with Quote
If there is, then try www.google.com Otherwise you'll have to create the wrapper yourself.

Go to Top of Page

VBBR
Moderator

Brazil
617 Posts

Posted - May 01 2004 :  8:34:21 PM  Show Profile  Reply with Quote
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?

Whatever. Who knows...

Edited by - VBBR on May 01 2004 8:34:52 PM
Go to Top of Page

Eric Coleman
Gladiator

USA
811 Posts

Posted - May 01 2004 :  9:18:59 PM  Show Profile  Visit Eric Coleman's Homepage  Reply with Quote
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
Go to Top of Page

VBBR
Moderator

Brazil
617 Posts

Posted - May 02 2004 :  09:04:48 AM  Show Profile  Reply with Quote
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 )

Whatever. Who knows...

Edited by - VBBR on May 02 2004 09:05:19 AM
Go to Top of Page

Dan
Squire

United Kingdom
29 Posts

Posted - May 02 2004 :  10:54:23 AM  Show Profile  Visit Dan's Homepage  Reply with Quote
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?



Go to Top of Page

VBBR
Moderator

Brazil
617 Posts

Posted - May 02 2004 :  11:59:27 AM  Show Profile  Reply with Quote
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.


Whatever. Who knows...
Go to Top of Page

Eric Coleman
Gladiator

USA
811 Posts

Posted - May 02 2004 :  1:17:55 PM  Show Profile  Visit Eric Coleman's Homepage  Reply with Quote
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?
Go to Top of Page

VBBR
Moderator

Brazil
617 Posts

Posted - May 02 2004 :  1:51:38 PM  Show Profile  Reply with Quote
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...

Whatever. Who knows...
Go to Top of Page

Spodi
Warrior

USA
142 Posts

Posted - May 02 2004 :  2:09:19 PM  Show Profile  Visit Spodi's Homepage  Send Spodi an AOL message  Click to see Spodi's MSN Messenger address  Send Spodi a Yahoo! Message  Reply with Quote
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.

vbGORE
Go to Top of Page

Dan
Squire

United Kingdom
29 Posts

Posted - May 02 2004 :  2:58:52 PM  Show Profile  Visit Dan's Homepage  Reply with Quote
here is a good tutorial for the control (named msscript.ocx)

http://www.thescarms.com/VBasic/Scripting.asp


Go to Top of Page

Eric Coleman
Gladiator

USA
811 Posts

Posted - May 02 2004 :  4:10:22 PM  Show Profile  Visit Eric Coleman's Homepage  Reply with Quote
What compiler are you using for the C code? Are you compiling it into a regular DLL or a COM DLL?
Go to Top of Page

VBBR
Moderator

Brazil
617 Posts

Posted - May 02 2004 :  5:13:06 PM  Show Profile  Reply with Quote
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.

Whatever. Who knows...
Go to Top of Page

Eric Coleman
Gladiator

USA
811 Posts

Posted - May 02 2004 :  7:00:52 PM  Show Profile  Visit Eric Coleman's Homepage  Reply with Quote
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.
Go to Top of Page

Mikey
Neophyte

USA
1 Posts

Posted - Feb 09 2005 :  9:38:56 PM  Show Profile  Visit Mikey's Homepage  Send Mikey an AOL message  Click to see Mikey's MSN Messenger address  Reply with Quote
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.
Go to Top of Page

Eric Coleman
Gladiator

USA
811 Posts

Posted - Feb 09 2005 :  10:13:03 PM  Show Profile  Visit Eric Coleman's Homepage  Reply with Quote
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.
Go to Top of Page
Page: of 2 Previous Topic Topic Next Topic  
Next Page
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
VBGamer © Go To Top Of Page
This page was generated in 0.19 seconds. Snitz Forums 2000

Copyright © 2002 - 2004 Eric Coleman, Peter Kuchnio , et. al.