scripting system in an application

Started by
6 comments, last by cignox1 17 years, 1 month ago
Hi all, I was asked to discover a way to give to the user of our tools a way to write easy scripts to interact both with the program and a database. The script language must be able to write GUI components. Our system is written in C# and the scripts need to run both in windows and linux (under mono). We were thinking to store the forms in a XML file, but we are unsure about what to use as scripting system (something like python with a tcp connection to the app?). Someone has already had to do with this before? Thank you!
Advertisement
Python's philosophy, iirc, is to extend Python instead of embedding it into an application.

Lua's original purpose was a embedable configuration script, and as such has a very convenient data representation syntax, and a small footprint. It's also a tiny language.

Both have a friendly syntax for non-programmers, so they're both usable. I'd take a look at Lua before deciding on Python though.

There's IronPython and an article on this site on how to use Lua with C#, so both are feasible if you want to integrate them with your application.

Setting up a tcp connection seems like a lot more work than simply making the needed functions avaliable in the scripting language as native functions though.
Thank you, this LuaInterface seem a very nice thing. I will give it a look. Do you know if it does handle GUI as well (that is, if you can create windows and forms through a Lua script?).
Thank you again!
Lua in general offers pretty powerful and deep bindings between your "back end" (C# in this case) code and the Lua scripts themselves. You may have to stitch in a bit of plumbing to allow your scripts to do GUI work, but it's thoroughly possible.

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

You can use c# itself as a scripting language, compiling and running the scripts at runtime. It is much easier to implement and the script can directly access .net framework and create GUI components.
Quote:Original post by Kambiz
You can use c# itself as a scripting language, compiling and running the scripts at runtime. It is much easier to implement and the script can directly access .net framework and create GUI components.


Yes I knew that, but when we talked about this possible solution, we were said that we couldn't expect them to learn C# just for scripting pourposes. We need something much more simple and fast to learn... Lua would be good, I suppose...

EDIT: I have just told that we will most probably use VBA. Do you think that this is a better way than using Lua?
Hello,

IronPython is the language I use for my own game engine. IronPython is a version that has been embedded into .NET Framework and can therefore use .NET Components, which means you can interface with Windows Forms (GUI).

It is also possible to catch exceptions AND debug, with IronPython. As far as I know, lua code cannot be debugged, but I might be wrong here.

It has been said that IronPython code is being executed twice as fast as CPython (the not .NET integrated version of Python). I don't know how much faster (if it is) compared to Lua, but if performance is a requirement, I think it is safer to use IronPython, because it is supported and developed by Microsoft. (I know this is a flawed generalisation, but since MS developed .NET Framework, it safe to assume they know how to integrate a script-language in it).

Hope this helps,

Regards,

Xeile
Thank you Xeile, I think we will go with vba but if we change idea, then I will give it a look.
Thank you all.

This topic is closed to new replies.

Advertisement