<p>Does anyone know of any DLLs (preferably .net) that encapsulate the lua 5.1 compiler?  I'm working on a .net project where part of it needs to compile lua scripts, and i would rather have a DLL that i could send script code to instead of sending the script to a temporary file and running luac.exe.</p>

<p>Edit: I'd need a .NET library that implements luac in such a way that it outputs standard lua bytecode (not a lua library that compiles to the CLR).  Compiling the lua c source code didn't work, as when i went to include a reference to the dll in a c# project, visual studio complained that it wasnt a valid assembly.  My searches so far haven't found anything.</p>

Have you looked into using something like Spring's proxy functionality?  You tell it a bit about the webservice in a spring config file, and all your client code has to deal with is an interface that you create - it doesn't even have to know that there is a web service on the other side!
Example Spring config:
```
```
<bean id="myService" class="org.springframework.remoting.jaxrpc.JaxRpcPortProxyFactoryBean">
    <property name="serviceFactoryClass" value="org.apache.axis.client.ServiceFactory"/>
    <property name="wsdlDocumentUrl" value="classpath://META-INF/myService.wsdl"/>
    <property name="namespaceUri" value="http://com/myService"/>
    <property name="endpointAddress" value="http://server/MyService"/>
    <property name="serviceName" value="MyService"/>
    <property name="portName" value="MyService"/>
    <property name="serviceInterface" value="com.IMyService"/>
    <property name="lookupServiceOnStartup" value="false"/>
</bean>
<bean id="myClient" class="com.MyServiceClient">
    <property name="myService" ref="myService"/>
</bean>
```
```
Java:
```
```
public interface IMyService {
    Foo getFoo();
}

public class MyServiceClient {
    private IMyService myService;
    public void setMyService(IMyService myService) {
        this.myService = myService;
    }

    public void DoStuff() {
        Foo foo = myService.getFoo();
        ...
    }
}
```
```
For custom objects, you may need to subclass JaxRpcPortProxyFactoryBean:
```
```
public class MyServiceFactoryBean extends JaxRpcPortProxyFactoryBean {
protected void postProcessJaxRpcService(Service service) {
    TypeMappingRegistry registry = service.getTypeMappingRegistry();
    TypeMapping mapping = registry.createTypeMapping();
            QName qName = new QName("http://com/myService", "Foo");
    mapping.register(Foo.class, qName,
            new BeanSerializerFactory(Foo.class, qName),
            new BeanDeserializerFactory(Foo.class, qName));
    }
}
```
```
What I love about this is that code that
shouldn't
care about the implementation of the service
doesn't
.  Testing becomes a breeze, and the cohesion of your classes is
much
better.