Commit 2271a771 authored by Vinicius Jarina's avatar Vinicius Jarina
Browse files

Fixed test on iOS (device)

parent bf8c5fe6
Subproject commit 31271cd6f1b77768e6f70b4848e22fbc96b17338
Subproject commit 980e734233b9273426ba853b7078fddbc1f07549
Subproject commit f6a5029fb6650fe1cb763de1adf0df2f76a2fab6
Subproject commit ed5b8b89e20a6e230e12da1059918f6609bde2eb
......@@ -30,7 +30,11 @@ using LuaInterface.Extensions;
namespace LuaInterface
{
#if USE_KOPILUA
using LuaCore = KopiLua.Lua;
#else
using LuaCore = KeraLua.Lua;
#endif
/*
* Type checking and conversion functions.
......
......@@ -26,7 +26,11 @@ using System;
namespace LuaInterface.Event
{
#if USE_KOPILUA
using LuaCore = KopiLua.Lua;
#else
using LuaCore = KeraLua.Lua;
#endif
/// <summary>
/// Event args for hook callback event
......
......@@ -44,7 +44,7 @@ namespace LuaInterface.Extensions
public static bool IsNull (this IntPtr ptr)
{
return (ptr == null || ptr.Equals (IntPtr.Zero));
return (ptr.Equals (IntPtr.Zero));
}
}
}
\ No newline at end of file
......@@ -26,7 +26,11 @@ using System;
namespace LuaInterface
{
#if USE_KOPILUA
using LuaCore = KopiLua.Lua;
#else
using LuaCore = KeraLua.Lua;
#endif
/*
* Class used for generating delegates that get a table from the Lua
* stack as a an object of a specific type.
......
......@@ -26,7 +26,11 @@ using System;
namespace LuaInterface
{
#if USE_KOPILUA
using LuaCore = KopiLua.Lua;
#else
using LuaCore = KeraLua.Lua;
#endif
/*
* Class used for generating delegates that get a function from the Lua
* stack as a delegate of a specific type.
......
......@@ -36,7 +36,11 @@ using LuaInterface.Extensions;
namespace LuaInterface
{
#if USE_KOPILUA
using LuaCore = KopiLua.Lua;
#else
using LuaCore = KeraLua.Lua;
#endif
/*
* Main class of LuaInterface
......@@ -165,6 +169,7 @@ namespace LuaInterface
LuaLib.lua_settable (luaState, -3);
LuaLib.lua_replace (luaState, (int)LuaIndexes.Globals);
translator = new ObjectTranslator (this, luaState);
ObjectTranslatorPool.Instance.Add (luaState, translator);
LuaLib.lua_replace (luaState, (int)LuaIndexes.Globals);
LuaLib.luaL_dostring (luaState, Lua.init_luanet); // steffenj: lua_dostring renamed to luaL_dostring
......@@ -200,6 +205,7 @@ namespace LuaInterface
LuaLib.lua_settable (lState, -3);
LuaLib.lua_replace (lState, (int)LuaIndexes.Globals);
translator = new ObjectTranslator (this, luaState);
ObjectTranslatorPool.Instance.Add (luaState, translator);
LuaLib.lua_replace (lState, (int)LuaIndexes.Globals);
LuaLib.luaL_dostring (lState, Lua.init_luanet); // steffenj: lua_dostring renamed to luaL_dostring
}
......@@ -235,8 +241,10 @@ namespace LuaInterface
return;
////// if(luaState != LuaCore.lua_State.Zero)
if (!luaState.IsNull ())
if (!luaState.IsNull ()) {
LuaCore.lua_close (luaState);
ObjectTranslatorPool.Instance.Remove (luaState);
}
//luaState = LuaCore.lua_State.Zero; <- suggested by Christopher Cebulski http://luaforge.net/forum/forum.php?thread_id = 44593&forum_id = 146
}
......@@ -733,7 +741,7 @@ namespace LuaInterface
public int SetDebugHook (EventMasks mask, int count)
{
if (hookCallback.IsNull ()) {
hookCallback = new LuaCore.lua_Hook (DebugHookCallback);
hookCallback = new LuaCore.lua_Hook (Lua.DebugHookCallback);
return LuaCore.lua_sethook (luaState, hookCallback, (int)mask, count);
}
......@@ -875,7 +883,15 @@ namespace LuaInterface
[MonoTouch.MonoPInvokeCallback (typeof (LuaCore.lua_Hook))]
#endif
[System.Runtime.InteropServices.AllowReversePInvokeCalls]
private void DebugHookCallback (LuaCore.lua_State luaState, LuaCore.lua_Debug luaDebug)
private static void DebugHookCallback (LuaCore.lua_State luaState, LuaCore.lua_Debug luaDebug)
{
var translator = ObjectTranslatorPool.Instance.Find (luaState);
var lua = translator.Interpreter;
lua.DebugHookCallbackInternal (luaState, luaDebug);
}
private void DebugHookCallbackInternal (LuaCore.lua_State luaState, LuaCore.lua_Debug luaDebug)
{
try {
var temp = DebugHook;
......
......@@ -28,7 +28,11 @@ using System.Collections.Generic;
namespace LuaInterface
{
#if USE_KOPILUA
using LuaCore = KopiLua.Lua;
#else
using LuaCore = KeraLua.Lua;
#endif
public class LuaFunction : LuaBase
{
......
......@@ -17,7 +17,7 @@
<DebugType>full</DebugType>
<Optimize>False</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;MONOTOUCH</DefineConstants>
<DefineConstants>DEBUG;MONOTOUCH;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>False</ConsolePause>
......@@ -29,7 +29,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>False</ConsolePause>
<DefineConstants>MONOTOUCH</DefineConstants>
<DefineConstants>MONOTOUCH;</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
......@@ -91,6 +91,7 @@
<Compile Include="Metatables.cs" />
<Compile Include="ObjectTranslator.cs" />
<Compile Include="ProxyType.cs" />
<Compile Include="ObjectTranslatorPool.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\KeraLua\KeraLua.iOS.csproj">
......
......@@ -12,7 +12,6 @@
<AssemblyName>LuaInterface</AssemblyName>
<ReleaseVersion>2.x</ReleaseVersion>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>True</DebugSymbols>
......@@ -79,6 +78,7 @@
<Compile Include="LuaLib\GCOptions.cs" />
<Compile Include="LuaLib\LuaLib.cs" />
<Compile Include="Config\LuaInterfaceConfig.cs" />
<Compile Include="ObjectTranslatorPool.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
......@@ -90,7 +90,7 @@
-->
<ItemGroup>
<ProjectReference Include="..\KeraLua\KeraLua.csproj">
<Project>{47153754-10f5-44d8-b578-f5a32b69061a}</Project>
<Project>{47153754-10F5-44D8-B578-F5A32B69061A}</Project>
<Name>KeraLua</Name>
</ProjectReference>
<ProjectReference Include="..\KopiLua\KopiLua.csproj">
......
......@@ -29,7 +29,11 @@ using LuaInterface.Extensions;
namespace LuaInterface
{
#if USE_KOPILUA
using LuaCore = KopiLua.Lua;
#else
using LuaCore = KeraLua.Lua;
#endif
public class LuaLib
{
......
......@@ -29,7 +29,11 @@ using System.Collections.Generic;
namespace LuaInterface
{
#if USE_KOPILUA
using LuaCore = KopiLua.Lua;
#else
using LuaCore = KeraLua.Lua;
#endif
/*
* Wrapper class for Lua tables
......
......@@ -28,7 +28,11 @@ using System.Collections.Generic;
namespace LuaInterface
{
#if USE_KOPILUA
using LuaCore = KopiLua.Lua;
#else
using LuaCore = KeraLua.Lua;
#endif
public class LuaUserData : LuaBase
{
......
......@@ -34,7 +34,11 @@ using LuaInterface.Extensions;
namespace LuaInterface
{
#if USE_KOPILUA
using LuaCore = KopiLua.Lua;
#else
using LuaCore = KeraLua.Lua;
#endif
/*
* Functions used in the metatables of userdata representing
......@@ -43,7 +47,7 @@ namespace LuaInterface
* Author: Fabio Mascarenhas
* Version: 1.0
*/
class MetaFunctions
public class MetaFunctions
{
internal LuaCore.lua_CFunction gcFunction, indexFunction, newindexFunction, baseIndexFunction,
classIndexFunction, classNewindexFunction, execDelegateFunction, callConstructorFunction, toStringFunction;
......@@ -72,15 +76,15 @@ namespace LuaInterface
public MetaFunctions (ObjectTranslator translator)
{
this.translator = translator;
gcFunction = new LuaCore.lua_CFunction (this.collectObject);
toStringFunction = new LuaCore.lua_CFunction (this.toString);
indexFunction = new LuaCore.lua_CFunction (this.getMethod);
newindexFunction = new LuaCore.lua_CFunction (this.setFieldOrProperty);
baseIndexFunction = new LuaCore.lua_CFunction (this.getBaseMethod);
callConstructorFunction = new LuaCore.lua_CFunction (this.callConstructor);
classIndexFunction = new LuaCore.lua_CFunction (this.getClassMethod);
classNewindexFunction = new LuaCore.lua_CFunction (this.setClassFieldOrProperty);
execDelegateFunction = new LuaCore.lua_CFunction (this.runFunctionDelegate);
gcFunction = new LuaCore.lua_CFunction (MetaFunctions.collectObject);
toStringFunction = new LuaCore.lua_CFunction (MetaFunctions.toString);
indexFunction = new LuaCore.lua_CFunction (MetaFunctions.getMethod);
newindexFunction = new LuaCore.lua_CFunction (MetaFunctions.setFieldOrProperty);
baseIndexFunction = new LuaCore.lua_CFunction (MetaFunctions.getBaseMethod);
callConstructorFunction = new LuaCore.lua_CFunction (MetaFunctions.callConstructor);
classIndexFunction = new LuaCore.lua_CFunction (MetaFunctions.getClassMethod);
classNewindexFunction = new LuaCore.lua_CFunction (MetaFunctions.setClassFieldOrProperty);
execDelegateFunction = new LuaCore.lua_CFunction (MetaFunctions.runFunctionDelegate);
}
/*
......@@ -90,7 +94,13 @@ namespace LuaInterface
[MonoTouch.MonoPInvokeCallback (typeof (LuaCore.lua_CFunction))]
#endif
[System.Runtime.InteropServices.AllowReversePInvokeCalls]
private int runFunctionDelegate (LuaCore.lua_State luaState)
private static int runFunctionDelegate (LuaCore.lua_State luaState)
{
var translator = ObjectTranslatorPool.Instance.Find (luaState);
return runFunctionDelegate (luaState, translator);
}
private static int runFunctionDelegate (LuaCore.lua_State luaState, ObjectTranslator translator)
{
LuaCore.lua_CFunction func = (LuaCore.lua_CFunction)translator.getRawNetObject (luaState, 1);
LuaLib.lua_remove (luaState, 1);
......@@ -104,15 +114,18 @@ namespace LuaInterface
[MonoTouch.MonoPInvokeCallback (typeof (LuaCore.lua_CFunction))]
#endif
[System.Runtime.InteropServices.AllowReversePInvokeCalls]
private int collectObject (LuaCore.lua_State luaState)
private static int collectObject (LuaCore.lua_State luaState)
{
var translator = ObjectTranslatorPool.Instance.Find (luaState);
return collectObject (luaState, translator);
}
private static int collectObject (LuaCore.lua_State luaState, ObjectTranslator translator)
{
int udata = LuaLib.luanet_rawnetobj (luaState, 1);
if (udata != -1)
translator.collectObject (udata);
else {
// Debug.WriteLine("not found: " + udata);
}
return 0;
}
......@@ -124,7 +137,13 @@ namespace LuaInterface
[MonoTouch.MonoPInvokeCallback (typeof (LuaCore.lua_CFunction))]
#endif
[System.Runtime.InteropServices.AllowReversePInvokeCalls]
private int toString (LuaCore.lua_State luaState)
private static int toString (LuaCore.lua_State luaState)
{
var translator = ObjectTranslatorPool.Instance.Find (luaState);
return toString (luaState, translator);
}
private static int toString (LuaCore.lua_State luaState, ObjectTranslator translator)
{
object obj = translator.getRawNetObject (luaState, 1);
......@@ -172,7 +191,14 @@ namespace LuaInterface
[MonoTouch.MonoPInvokeCallback (typeof (LuaCore.lua_CFunction))]
#endif
[System.Runtime.InteropServices.AllowReversePInvokeCalls]
private int getMethod (LuaCore.lua_State luaState)
private static int getMethod (LuaCore.lua_State luaState)
{
var translator = ObjectTranslatorPool.Instance.Find (luaState);
var instance = translator.MetaFunctionsInstance;
return instance.getMethodInternal (luaState);
}
private int getMethodInternal (LuaCore.lua_State luaState)
{
object obj = translator.getRawNetObject (luaState, 1);
......@@ -267,7 +293,14 @@ namespace LuaInterface
[MonoTouch.MonoPInvokeCallback (typeof (LuaCore.lua_CFunction))]
#endif
[System.Runtime.InteropServices.AllowReversePInvokeCalls]
private int getBaseMethod (LuaCore.lua_State luaState)
private static int getBaseMethod (LuaCore.lua_State luaState)
{
var translator = ObjectTranslatorPool.Instance.Find (luaState);
var instance = translator.MetaFunctionsInstance;
return instance.getBaseMethodInternal (luaState);
}
private int getBaseMethodInternal (LuaCore.lua_State luaState)
{
object obj = translator.getRawNetObject (luaState, 1);
......@@ -468,7 +501,14 @@ namespace LuaInterface
[MonoTouch.MonoPInvokeCallback (typeof (LuaCore.lua_CFunction))]
#endif
[System.Runtime.InteropServices.AllowReversePInvokeCalls]
private int setFieldOrProperty (LuaCore.lua_State luaState)
private static int setFieldOrProperty (LuaCore.lua_State luaState)
{
var translator = ObjectTranslatorPool.Instance.Find (luaState);
var instance = translator.MetaFunctionsInstance;
return instance.setFieldOrPropertyInternal (luaState);
}
private int setFieldOrPropertyInternal (LuaCore.lua_State luaState)
{
object target = translator.getRawNetObject (luaState, 1);
......@@ -635,7 +675,14 @@ namespace LuaInterface
[MonoTouch.MonoPInvokeCallback (typeof (LuaCore.lua_CFunction))]
#endif
[System.Runtime.InteropServices.AllowReversePInvokeCalls]
private int getClassMethod (LuaCore.lua_State luaState)
private static int getClassMethod (LuaCore.lua_State luaState)
{
var translator = ObjectTranslatorPool.Instance.Find (luaState);
var instance = translator.MetaFunctionsInstance;
return instance.getClassMethodInternal (luaState);
}
private int getClassMethodInternal (LuaCore.lua_State luaState)
{
IReflect klass;
object obj = translator.getRawNetObject (luaState, 1);
......@@ -670,7 +717,14 @@ namespace LuaInterface
[MonoTouch.MonoPInvokeCallback (typeof (LuaCore.lua_CFunction))]
#endif
[System.Runtime.InteropServices.AllowReversePInvokeCalls]
private int setClassFieldOrProperty (LuaCore.lua_State luaState)
private static int setClassFieldOrProperty (LuaCore.lua_State luaState)
{
var translator = ObjectTranslatorPool.Instance.Find (luaState);
var instance = translator.MetaFunctionsInstance;
return instance.setClassFieldOrPropertyInternal (luaState);
}
private int setClassFieldOrPropertyInternal (LuaCore.lua_State luaState)
{
IReflect target;
object obj = translator.getRawNetObject (luaState, 1);
......@@ -694,7 +748,14 @@ namespace LuaInterface
[MonoTouch.MonoPInvokeCallback (typeof (LuaCore.lua_CFunction))]
#endif
[System.Runtime.InteropServices.AllowReversePInvokeCalls]
private int callConstructor (LuaCore.lua_State luaState)
private static int callConstructor (LuaCore.lua_State luaState)
{
var translator = ObjectTranslatorPool.Instance.Find (luaState);
var instance = translator.MetaFunctionsInstance;
return instance.callConstructorInternal (luaState);
}
private int callConstructorInternal (LuaCore.lua_State luaState)
{
var validConstructor = new MethodCache ();
IReflect klass;
......
......@@ -30,7 +30,11 @@ using LuaInterface.Extensions;
namespace LuaInterface.Method
{
#if USE_KOPILUA
using LuaCore = KopiLua.Lua;
#else
using LuaCore = KeraLua.Lua;
#endif
/*
* Argument extraction with type-conversion function
......@@ -108,10 +112,6 @@ namespace LuaInterface.Method
* Calls the method. Receives the arguments from the Lua stack
* and returns values in it.
*/
#if MONOTOUCH
[MonoTouch.MonoPInvokeCallback (typeof (LuaCore.lua_CFunction))]
#endif
[System.Runtime.InteropServices.AllowReversePInvokeCalls]
int call (LuaCore.lua_State luaState)
{
var methodToCall = _Method;
......
......@@ -34,7 +34,11 @@ using LuaInterface.Extensions;
namespace LuaInterface
{
#if USE_KOPILUA
using LuaCore = KopiLua.Lua;
#else
using LuaCore = KeraLua.Lua;
#endif
/*
* Passes objects from the CLR to Lua and vice-versa
......@@ -60,6 +64,18 @@ namespace LuaInterface
/// </summary>
private int nextObj = 0;
public MetaFunctions MetaFunctionsInstance {
get {
return metaFunctions;
}
}
public Lua Interpreter {
get {
return interpreter;
}
}
public ObjectTranslator (Lua interpreter, LuaCore.lua_State luaState)
{
this.interpreter = interpreter;
......@@ -67,12 +83,12 @@ namespace LuaInterface
metaFunctions = new MetaFunctions (this);
assemblies = new List<Assembly> ();
importTypeFunction = new LuaCore.lua_CFunction (this.importType);
loadAssemblyFunction = new LuaCore.lua_CFunction (this.loadAssembly);
registerTableFunction = new LuaCore.lua_CFunction (this.registerTable);
unregisterTableFunction = new LuaCore.lua_CFunction (this.unregisterTable);
getMethodSigFunction = new LuaCore.lua_CFunction (this.getMethodSignature);
getConstructorSigFunction = new LuaCore.lua_CFunction (this.getConstructorSignature);
importTypeFunction = new LuaCore.lua_CFunction (ObjectTranslator.importType);
loadAssemblyFunction = new LuaCore.lua_CFunction (ObjectTranslator.loadAssembly);
registerTableFunction = new LuaCore.lua_CFunction (ObjectTranslator.registerTable);
unregisterTableFunction = new LuaCore.lua_CFunction (ObjectTranslator.unregisterTable);
getMethodSigFunction = new LuaCore.lua_CFunction (ObjectTranslator.getMethodSignature);
getConstructorSigFunction = new LuaCore.lua_CFunction (ObjectTranslator.getConstructorSignature);
createLuaObjectList (luaState);
createIndexingMetaFunction (luaState);
......@@ -236,7 +252,13 @@ namespace LuaInterface
[MonoTouch.MonoPInvokeCallback (typeof (LuaCore.lua_CFunction))]
#endif
[System.Runtime.InteropServices.AllowReversePInvokeCalls]
private int loadAssembly (LuaCore.lua_State luaState)
private static int loadAssembly (LuaCore.lua_State luaState)
{
var translator = ObjectTranslatorPool.Instance.Find (luaState);
return translator.loadAssemblyInternal (luaState);
}
private int loadAssemblyInternal (LuaCore.lua_State luaState)
{
try {
string assemblyName = LuaLib.lua_tostring (luaState, 1).ToString ();
......@@ -279,7 +301,13 @@ namespace LuaInterface
[MonoTouch.MonoPInvokeCallback (typeof (LuaCore.lua_CFunction))]
#endif
[System.Runtime.InteropServices.AllowReversePInvokeCalls]
private int importType (LuaCore.lua_State luaState)
private static int importType (LuaCore.lua_State luaState)
{
var translator = ObjectTranslatorPool.Instance.Find (luaState);
return translator.importTypeInternal (luaState);
}
private int importTypeInternal (LuaCore.lua_State luaState)
{
string className = LuaLib.lua_tostring (luaState, 1).ToString ();
var klass = FindType (className);
......@@ -301,7 +329,13 @@ namespace LuaInterface
[MonoTouch.MonoPInvokeCallback (typeof (LuaCore.lua_CFunction))]
#endif
[System.Runtime.InteropServices.AllowReversePInvokeCalls]
private int registerTable (LuaCore.lua_State luaState)
private static int registerTable (LuaCore.lua_State luaState)
{
var translator = ObjectTranslatorPool.Instance.Find (luaState);
return translator.registerTableInternal (luaState);
}
private int registerTableInternal (LuaCore.lua_State luaState)
{
if (LuaLib.lua_type (luaState, 1) == LuaTypes.Table) {
var luaTable = getTable (luaState, 1);
......@@ -347,7 +381,13 @@ namespace LuaInterface
[MonoTouch.MonoPInvokeCallback (typeof (LuaCore.lua_CFunction))]
#endif
[System.Runtime.InteropServices.AllowReversePInvokeCalls]
private int unregisterTable (LuaCore.lua_State luaState)
private static int unregisterTable (LuaCore.lua_State luaState)
{
var translator = ObjectTranslatorPool.Instance.Find (luaState);
return translator.unregisterTableInternal (luaState);
}
private int unregisterTableInternal (LuaCore.lua_State luaState)
{
try {
if (LuaLib.lua_getmetatable (luaState, 1) != 0) {
......@@ -386,7 +426,13 @@ namespace LuaInterface
[MonoTouch.MonoPInvokeCallback (typeof (LuaCore.lua_CFunction))]
#endif
[System.Runtime.InteropServices.AllowReversePInvokeCalls]
private int getMethodSignature (LuaCore.lua_State luaState)
private static int getMethodSignature (LuaCore.lua_State luaState)
{
var translator = ObjectTranslatorPool.Instance.Find (luaState);
return translator.getMethodSignatureInternal (luaState);
}
private int getMethodSignatureInternal (LuaCore.lua_State luaState)
{
IReflect klass;
object target;
......@@ -434,7 +480,13 @@ namespace LuaInterface
[MonoTouch.MonoPInvokeCallback (typeof (LuaCore.lua_CFunction))]
#endif
[System.Runtime.InteropServices.AllowReversePInvokeCalls]
private int getConstructorSignature (LuaCore.lua_State luaState)
private static int getConstructorSignature (LuaCore.lua_State luaState)
{
var translator = ObjectTranslatorPool.Instance.Find (luaState);
return translator.getConstructorSignatureInternal (luaState);
}
private int getConstructorSignatureInternal (LuaCore.lua_State luaState)
{
IReflect klass = null;
int udata = LuaLib.luanet_checkudata (luaState, 1, "luaNet_class");
......
using System;
using System.Collections.Generic;
namespace LuaInterface
{
#if USE_KOPILUA
using LuaCore = KopiLua.Lua;
#else
using LuaCore = KeraLua.Lua;
#endif
internal class ObjectTranslatorPool
{
private static volatile ObjectTranslatorPool instance = new ObjectTranslatorPool ();
private static object syncRoot = new object ();
private Dictionary<LuaCore.lua_State, ObjectTranslator> translators = new Dictionary<LuaCore.lua_State, ObjectTranslator>();
public static ObjectTranslatorPool Instance
{
get
{
return instance;
}
}
public ObjectTranslatorPool ()
{
syncRoot = new Dictionary<LuaCore.lua_State, ObjectTranslator> ();
}
public void Add (LuaCore.lua_State luaState, ObjectTranslator translator)
{
translators.Add(luaState , translator);
}
public ObjectTranslator Find (LuaCore.lua_State luaState)
{
if (!translators.ContainsKey(luaState))
return null;
return translators [luaState];
}
public void Remove (LuaCore.lua_State luaState)
{
if (!translators.ContainsKey (luaState))
return;
translators.Remove (luaState);
}
}
}
......@@ -64,7 +64,9 @@
<IpaPackageName />
<MtouchI18n />
<MtouchArch>ARMv7</MtouchArch>
<MtouchLink>Full</MtouchLink>
<MtouchLink>None</MtouchLink>
<MtouchUseLlvm>true</MtouchUseLlvm>
<MtouchUseThumb>true</MtouchUseThumb>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Ad-Hoc|iPhone' ">
<DebugType>none</DebugType>
......
......@@ -348,6 +348,16 @@ namespace LuaInterfaceTest
//lua.RegisterFunction("regularMethod", genericClass, typeof(TestClassGeneric<>).GetMethod("RegularMethod"));
using (Lua lua = new Lua ()) {
TestClassWithGenericMethod classWithGenericMethod = new TestClassWithGenericMethod ();
////////////////////////////////////////////////////////////////////////////
/// ////////////////////////////////////////////////////////////////////////
/// IMPORTANT: Use generic method with the type you will call or generic methods will fail with iOS
/// ////////////////////////////////////////////////////////////////////////
classWithGenericMethod.GenericMethod<double>(99.0);
classWithGenericMethod.GenericMethod<TestClass>(new TestClass (99));
////////////////////////////////////////////////////////////////////////////
/// ////////////////////////////////////////////////////////////////////////
lua.RegisterFunction ("genericMethod2", classWithGenericMethod, typeof(TestClassWithGenericMethod).GetMethod ("GenericMethod"));
try {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment