8/31/2013

Precautions in luainterface 2.0.3


For In visual studio 2010, below section should be added in app.config. Since luainterface was compiled as clr version 2.0, 'useLegacyV2RuntimeActivationPlicy' is must be set to true.
<startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0"/>
</startup>


For reference a C# object in luainterface, the namespace of the reference object should be different with program main interface. For example, if I address the name of project as 'DrwaDesk', the main namespsce will be 'DrawDesk'. If I want to reference 'Book' class in luainterface, the 'Book' class should have different
namespace with 'DrawDesk'.
namespace DrawDesk
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
        }
    }
}
namespace ShredTypes
{
    class Book
    {
    }
}

Lastly, there is no sleep function in lua. So using os.time() or os.clock(), we normaly make sleep function. However, if the function call in several processes, it will throw exception. A possible solution for this, just wrap function which use the sleep function of C# and call this wrap function in Luainterface.