I am reading a book on Game Development in which they show you how to make scripts for your game in Lua. They program Lua and use it from C++, but I was wondering if there is a library or API to use Lua from C#: specifically from XNA to develop games for PC and XBox 360?
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Questions about "how to get started," "what to learn next," or "which technology to use" are discussion-oriented questions which involve answers that are either based on opinion, or which are all equally valid. Those kinds of questions are outside the scope of this site. Visit our help center for more information." – Charanor, Tyyppi_77, DMGregory
This is were I would point you (http://www.xnua.com/xna_lua_xnua), but it hasn't been updated for a long time.
C# is great language, and could in a sense be used as a scripting language within your c# game. Nick Gravelyn has created some nice tutorials about tile engine (http://blog.nickgravelyn.com/downloads/#tileengine) and used a custom scripting engine to fire off dialog. He has also has a basic example when he learned about the "yield" keyword: http://blog.nickgravelyn.com/2010/02/the-magic-of-yield/
If you're looking for scripting in C#, definitely take a look at IronPython. It's not just a python API for C#, it is actually a completely separate python implementation which compiles to the same CLR assembly (with the same performance) that C# does, but can be interfaced with as a scripting language. Any Lua wrapper for C# would be much slow due to the overhead of Marshalling.
As Sean said, IronPython is worth looking at. IronPython is actually one of a few dynamic language implementations for .NET targeting the Dynamic Language Runtime (DLR). There is at least one open source project aimed at implementing Lua on the DLR (like this one), but I'm not sure if there are any implementations near completion. A well-implemented set of DLR bindings for Lua should provide performance on par with IronPython and IronRuby, and would be much faster than a Lua wrapper. For the sake of comparison, IronPython generally performs better than CPython (sometimes significantly better).
Note: As ElementCy states below, DLR languages are generally not supported on the Xbox 360. However, there is an "interpreted mode" in the DLR. I don't know enough about it to say for sure, but it might be possible to get IronPython (or other DLR language implementations) to run on the Xbox 360 in interpreted mode, though performance would certainly suffer. It might be worth asking someone on the DLR team whether they know this to be possible. If not, the Xbox 360 should get Reflection.Emit support as part of upcoming Silverlight support. If and when that happens, I imagine getting the DLR up and running on the Xbox 360 won't be a problem.
The best solution I could give you is to just script in C#. You can compile them at runtime when you target windows and compile them before hand for the xbox. (as a dll)
That would be the easiest solution. You could also do it in VB.NET or any .NET language. (not sure about the scripting ones though) Basically, I'm saying to have your scripts in their own dll. You can have them compile at runtime on Windows. (do you really want them to do this on the xbox 360?, you can't update your games on there, at least I don't think so)
I can understand your frustration, I wanted to use Lua as well.
To sum it up: 1) Have it built at runtime on Windows 2) Build it before hand for the Xbox 360
That's what I recommend.
Just to update this question, I spent the last day doing some extensive searching, and I've found that using UniLua (made for use with unity, pure C# implementation) is the best and most effective option for getting Lua on Xbox. I stripped it down, took out all the Unity material, and it works great.
I also added some functionality found in LuaInterface by overloading the  operator for LuaState, and such.
I hope this was useful.