views:

665

answers:

2

In my scenario I want to interpret a script file and execute methods from assemblies. What advantages would Lua offer me? If you have used both Lua and the CSharpCodeProvider please contrast your experience with both.

+1  A: 

The main advantage of C# is that it is compiled and JITted (although LUA has experimental code down those routes).

The main advantage of LUA is that it doesn't need to be compiled. It runs slower, but it has a better bootstrap time. It also has a lower amount of bootstrap code (e.g. you don't need to type using System; ... namespace MyNs { ... class MyClass { ... and so on).

In the end the reign of LUA in the scripting world is supreme: but it can't stand up to what C# can do in the performance world, and visa-versa.

Jonathan C Dickinson
Performance of scripts is often irrelevant. Can you comment on other aspects?
Norman Ramsey
Other aspects? I use scripting where scripting is appropriate and compiled where compiled is appropriate. Using a scripting language to create a rich enterprise CRM is a poor idea IMHO. Using C# to create a game script is just as pointless. Use the correct tool for the correct job: neither is better
Jonathan C Dickinson
Oh, also, CSharpCodeProvider is superior when you are writing programs using a program. Lua is superior when you need to allow the user to change functionality. CSharpCodeProvider is better (if used for scripting) for very advanced end users, Lua is better for advanced users.
Jonathan C Dickinson
Oh! As well, Lua is more contained. With C# you *could* by mistake allow a script to more than it should be allowed to. Lua's only interface to the outside world is what you give it. That said, C# is more flexible for script writers. My honest opinion is give the user the choice.
Jonathan C Dickinson
+1  A: 

Have you checked out IronPython? It is very similar to Lua, but is a native CLR language.

Mark Maxham