Multiple Scripting Languages

Posted by Nickpick on Mon 08 May 2006 05:07 PM — 3 posts, 16,581 views.

#0
Ok, I'll keep it short and simple. How can I switch from VBScript to Lua without having to rewrite all my old scripts.
USA #1
I think that the very short answer is: you can't. Unless you find a tool that will convert VBScript to Lua, you will have to rewrite your scripts.

It might be possible to run scripts of different languages, though; Nick would know for sure. That way all your old scripts would be in VBScript and your new ones in Lua.
Australia Forum Administrator #2
My suggestion is that you migrate your existing scripts to plugins, which can have VBscript as the language, and develop new ones in Lua. This is pretty easy to do.

Failing that, I converted the chat plugin from VBscript to Lua, they are not that dissimilar. There are differences, sure, but depending on how many scripts you have it isn't too bad.

Example:

VBscript:


If blah Then
  blah blah blah
EndIf


Lua:


if blah then
  blah blah blah
end -- if


See this forum post:

http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=6211

I discuss there the issues of correct capitalization of internal function names. For example in VBscript you would get away with using world.note, in Lua it has to be world.Note.

You could even compare the chat plugin before and after converting from VBscript to Lua. See the plugins page:

http://www.gammon.com.au/mushclient/plugins/

If you look at those you can see the differences. I kept the basic structure of the plugin the same.