Sign in to follow this  
cignox1

scripting system in an application

Recommended Posts

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!

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this