Lua with VB
VBBRIs there any ready wrapper/code/module/whatever that makes it possible to use [url="http://www.lua.org"]Lua[/url] 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. [:D]
Eric ColemanIf there is, then try www.google.com Otherwise you'll have to create the wrapper yourself.
VBBRI 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?
Eric ColemanI 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 [:)]
VBBROK 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 [:)])
DanI 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?
VBBRI'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.
Eric ColemanIf 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?
VBBRI 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...
SpodiYeah, 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.
Danhere is a good tutorial for the control (named msscript.ocx) http://www.thescarms.com/VBasic/Scripting.asp
Eric ColemanWhat compiler are you using for the C code? Are you compiling it into a regular DLL or a COM DLL?
VBBRI'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 ColemanA "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.