Commit 1aaf1544 authored by Vinicius Jarina's avatar Vinicius Jarina
Browse files

Migration to Unified Xamarin.iOS

parent 9dc02291
...@@ -10,16 +10,19 @@ using NLuaTest; ...@@ -10,16 +10,19 @@ using NLuaTest;
namespace ConsoleTest namespace ConsoleTest
{ {
public class Program public class Program
{ {
static void Main (string [] args) static void Main (string [] args)
{ {
using (var l = new Lua ()) { using (var l = new Lua ()) {
Action c = () => { Console.WriteLine ("Ola"); }; l.LoadCLRPackage ();
l ["d"] = c; l.DoString (" import ('ConsoleTest') ");
l.DoString (" d () "); l.DoString (@"
p=parameter()
r1 = testClass2.read(p) -- is not working. it is also not working if the method in base class has two parameters instead of one
r2 = testClass2.read(1) -- is working
");
} }
} }
} }
......
Subproject commit eff38fd1739ef2738d912d6872a2d4315d07af21 Subproject commit e31a48301af5c69a05766477e5d8c19928514a13
Subproject commit 2f0dfdcc50acca3e88afa6ef5cc5ad97f142e57a Subproject commit 2c66160f82469cf9aa73feb4a834dc31aa1dbc85
/* /*
* This file is part of NLua. * This file is part of NLua.
* *
* Copyright (c) 2014 Vinicius Jarina (viniciusjarina@gmail.com) * Copyright (c) 2014 Vinicius Jarina (viniciusjarina@gmail.com)
* Copyright (C) 2003-2005 Fabio Mascarenhas de Queiroz. * Copyright (C) 2003-2005 Fabio Mascarenhas de Queiroz.
* Copyright (C) 2012 Megax <http://megax.yeahunter.hu/> * Copyright (C) 2012 Megax <http://megax.yeahunter.hu/>
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights * in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is * copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions: * furnished to do so, subject to the following conditions:
* *
* The above copyright notice and this permission notice shall be included in * The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software. * all copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*/ */
using System; using System;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Reflection; using System.Reflection;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Specialized; using System.Collections.Specialized;
using NLua.Event; using NLua.Event;
using NLua.Method; using NLua.Method;
using NLua.Exceptions; using NLua.Exceptions;
using NLua.Extensions; using NLua.Extensions;
using ObjCRuntime;
namespace NLua
{ namespace NLua
#if USE_KOPILUA {
using LuaCore = KopiLua.Lua; #if USE_KOPILUA
using LuaState = KopiLua.LuaState; using LuaCore = KopiLua.Lua;
using LuaHook = KopiLua.LuaHook; using LuaState = KopiLua.LuaState;
using LuaDebug = KopiLua.LuaDebug; using LuaHook = KopiLua.LuaHook;
using LuaNativeFunction = KopiLua.LuaNativeFunction; using LuaDebug = KopiLua.LuaDebug;
#else using LuaNativeFunction = KopiLua.LuaNativeFunction;
using LuaCore = KeraLua.Lua; #else
using LuaState = KeraLua.LuaState; using LuaCore = KeraLua.Lua;
using LuaHook = KeraLua.LuaHook; using LuaState = KeraLua.LuaState;
using LuaDebug = KeraLua.LuaDebug; using LuaHook = KeraLua.LuaHook;
using LuaNativeFunction = KeraLua.LuaNativeFunction; using LuaDebug = KeraLua.LuaDebug;
#endif using LuaNativeFunction = KeraLua.LuaNativeFunction;
#endif
/*
* Main class of NLua /*
* Object-oriented wrapper to Lua API * Main class of NLua
* * Object-oriented wrapper to Lua API
* Author: Fabio Mascarenhas *
* Version: 1.0 * Author: Fabio Mascarenhas
* * Version: 1.0
* // steffenj: important changes in Lua class: *
* - removed all Open*Lib() functions * // steffenj: important changes in Lua class:
* - all libs automatically open in the Lua class constructor (just assign nil to unwanted libs) * - removed all Open*Lib() functions
* */ * - all libs automatically open in the Lua class constructor (just assign nil to unwanted libs)
[CLSCompliant(true)] * */
public class Lua : IDisposable [CLSCompliant(true)]
{ public class Lua : IDisposable
#region lua debug functions {
/// <summary> #region lua debug functions
/// Event that is raised when an exception occures during a hook call. /// <summary>
/// </summary> /// Event that is raised when an exception occures during a hook call.
public event EventHandler<HookExceptionEventArgs> HookException; /// </summary>
/// <summary> public event EventHandler<HookExceptionEventArgs> HookException;
/// Event when lua hook callback is called /// <summary>
/// </summary> /// Event when lua hook callback is called
/// <remarks> /// </summary>
/// Is only raised if SetDebugHook is called before. /// <remarks>
/// </remarks> /// Is only raised if SetDebugHook is called before.
public event EventHandler<DebugHookEventArgs> DebugHook; /// </remarks>
/// <summary> public event EventHandler<DebugHookEventArgs> DebugHook;
/// lua hook calback delegate /// <summary>
/// </summary> /// lua hook calback delegate
private LuaHook hookCallback = null; /// </summary>
#endregion private LuaHook hookCallback = null;
#region Globals auto-complete #endregion
private readonly List<string> globals = new List<string> (); #region Globals auto-complete
private bool globalsSorted; private readonly List<string> globals = new List<string> ();
#endregion private bool globalsSorted;
private LuaState luaState; #endregion
/// <summary> private LuaState luaState;
/// True while a script is being executed /// <summary>
/// </summary> /// True while a script is being executed
public bool IsExecuting { get { return executing; } } /// </summary>
public bool IsExecuting { get { return executing; } }
private LuaNativeFunction panicCallback;
private ObjectTranslator translator; private LuaNativeFunction panicCallback;
/// <summary> private ObjectTranslator translator;
/// Used to ensure multiple .net threads all get serialized by this single lock for access to the lua stack/objects /// <summary>
/// </summary> /// Used to ensure multiple .net threads all get serialized by this single lock for access to the lua stack/objects
//private object luaLock = new object(); /// </summary>
private bool _StatePassed; //private object luaLock = new object();
private bool executing; private bool _StatePassed;
static string initLuanet = private bool executing;
@"local metatable = {} static string initLuanet =
local rawget = rawget @"local metatable = {}
local import_type = luanet.import_type local rawget = rawget
local load_assembly = luanet.load_assembly local import_type = luanet.import_type
luanet.error, luanet.type = error, type local load_assembly = luanet.load_assembly
-- Lookup a .NET identifier component. luanet.error, luanet.type = error, type
function metatable:__index(key) -- key is e.g. 'Form' -- Lookup a .NET identifier component.
-- Get the fully-qualified name, e.g. 'System.Windows.Forms.Form' function metatable:__index(key) -- key is e.g. 'Form'
local fqn = rawget(self,'.fqn') -- Get the fully-qualified name, e.g. 'System.Windows.Forms.Form'
fqn = ((fqn and fqn .. '.') or '') .. key local fqn = rawget(self,'.fqn')
fqn = ((fqn and fqn .. '.') or '') .. key
-- Try to find either a luanet function or a CLR type
local obj = rawget(luanet,key) or import_type(fqn) -- Try to find either a luanet function or a CLR type
local obj = rawget(luanet,key) or import_type(fqn)
-- If key is neither a luanet function or a CLR type, then it is simply
-- an identifier component. -- If key is neither a luanet function or a CLR type, then it is simply
if obj == nil then -- an identifier component.
-- It might be an assembly, so we load it too. if obj == nil then
pcall(load_assembly,fqn) -- It might be an assembly, so we load it too.
obj = { ['.fqn'] = fqn } pcall(load_assembly,fqn)
setmetatable(obj, metatable) obj = { ['.fqn'] = fqn }
end setmetatable(obj, metatable)
end
-- Cache this lookup
rawset(self, key, obj) -- Cache this lookup
return obj rawset(self, key, obj)
end return obj
end
-- A non-type has been called; e.g. foo = System.Foo()
function metatable:__call(...) -- A non-type has been called; e.g. foo = System.Foo()
error('No such type: ' .. rawget(self,'.fqn'), 2) function metatable:__call(...)
end error('No such type: ' .. rawget(self,'.fqn'), 2)
end
-- This is the root of the .NET namespace
luanet['.fqn'] = false -- This is the root of the .NET namespace
setmetatable(luanet, metatable) luanet['.fqn'] = false
setmetatable(luanet, metatable)
-- Preload the mscorlib assembly
luanet.load_assembly('mscorlib')"; -- Preload the mscorlib assembly
luanet.load_assembly('mscorlib')";
static string clr_package = @"---
--- This lua module provides auto importing of .net classes into a named package. static string clr_package = @"---
--- Makes for super easy use of LuaInterface glue --- This lua module provides auto importing of .net classes into a named package.
--- --- Makes for super easy use of LuaInterface glue
--- example: ---
--- Threading = CLRPackage(""System"", ""System.Threading"") --- example:
--- Threading.Thread.Sleep(100) --- Threading = CLRPackage(""System"", ""System.Threading"")
--- --- Threading.Thread.Sleep(100)
--- Extensions: ---
--- import() is a version of CLRPackage() which puts the package into a list which is used by a global __index lookup, --- Extensions:
--- and thus works rather like C#'s using statement. It also recognizes the case where one is importing a local --- import() is a version of CLRPackage() which puts the package into a list which is used by a global __index lookup,
--- assembly, which must end with an explicit .dll extension. --- and thus works rather like C#'s using statement. It also recognizes the case where one is importing a local
--- assembly, which must end with an explicit .dll extension.
--- Alternatively, luanet.namespace can be used for convenience without polluting the global namespace:
--- local sys,sysi = luanet.namespace {'System','System.IO'} --- Alternatively, luanet.namespace can be used for convenience without polluting the global namespace:
-- sys.Console.WriteLine(""we are at {0}"",sysi.Directory.GetCurrentDirectory()) --- local sys,sysi = luanet.namespace {'System','System.IO'}
-- sys.Console.WriteLine(""we are at {0}"",sysi.Directory.GetCurrentDirectory())
-- LuaInterface hosted with stock Lua interpreter will need to explicitly require this...
if not luanet then require 'luanet' end -- LuaInterface hosted with stock Lua interpreter will need to explicitly require this...
if not luanet then require 'luanet' end
local import_type, load_assembly = luanet.import_type, luanet.load_assembly
local import_type, load_assembly = luanet.import_type, luanet.load_assembly
local mt = {
--- Lookup a previously unfound class and add it to our table local mt = {
__index = function(package, classname) --- Lookup a previously unfound class and add it to our table
local class = rawget(package, classname) __index = function(package, classname)
if class == nil then local class = rawget(package, classname)
class = import_type(package.packageName .. ""."" .. classname) if class == nil then
if class == nil then class = import_type(classname) end class = import_type(package.packageName .. ""."" .. classname)
package[classname] = class -- keep what we found around, so it will be shared if class == nil then class = import_type(classname) end
end package[classname] = class -- keep what we found around, so it will be shared
return class end
end return class
} end
}
function luanet.namespace(ns)
if type(ns) == 'table' then function luanet.namespace(ns)
local res = {} if type(ns) == 'table' then
for i = 1,#ns do local res = {}
res[i] = luanet.namespace(ns[i]) for i = 1,#ns do
end res[i] = luanet.namespace(ns[i])
return unpack(res) end
end return unpack(res)
-- FIXME - table.packageName could instead be a private index (see Lua 13.4.4) end
local t = { packageName = ns } -- FIXME - table.packageName could instead be a private index (see Lua 13.4.4)
setmetatable(t,mt) local t = { packageName = ns }
return t setmetatable(t,mt)
end return t
end
local globalMT, packages
local globalMT, packages
local function set_global_mt()
packages = {} local function set_global_mt()
globalMT = { packages = {}
__index = function(T,classname) globalMT = {
for i,package in ipairs(packages) do __index = function(T,classname)
local class = package[classname] for i,package in ipairs(packages) do
if class then local class = package[classname]
_G[classname] = class if class then
return class _G[classname] = class
end return class
end end
end end
} end
setmetatable(_G, globalMT) }
end setmetatable(_G, globalMT)
end
--- Create a new Package class
function CLRPackage(assemblyName, packageName) --- Create a new Package class
-- a sensible default... function CLRPackage(assemblyName, packageName)
packageName = packageName or assemblyName -- a sensible default...
local ok = pcall(load_assembly,assemblyName) -- Make sure our assembly is loaded packageName = packageName or assemblyName
return luanet.namespace(packageName) local ok = pcall(load_assembly,assemblyName) -- Make sure our assembly is loaded
end return luanet.namespace(packageName)
end
function import (assemblyName, packageName)
if not globalMT then function import (assemblyName, packageName)
set_global_mt() if not globalMT then
end set_global_mt()
if not packageName then end
local i = assemblyName:find('%.dll$') if not packageName then
if i then packageName = assemblyName:sub(1,i-1) local i = assemblyName:find('%.dll$')
else packageName = assemblyName end if i then packageName = assemblyName:sub(1,i-1)
end else packageName = assemblyName end
local t = CLRPackage(assemblyName,packageName) end
table.insert(packages,t) local t = CLRPackage(assemblyName,packageName)
return t table.insert(packages,t)
end return t
end
function luanet.make_array (tp,tbl)
local arr = tp[#tbl] function luanet.make_array (tp,tbl)
for i,v in ipairs(tbl) do local arr = tp[#tbl]
arr:SetValue(v,i-1) for i,v in ipairs(tbl) do
end arr:SetValue(v,i-1)
return arr end
end return arr
end
function luanet.each(o)
local e = o:GetEnumerator() function luanet.each(o)
return function() local e = o:GetEnumerator()
if e:MoveNext() then return function()
return e.Current if e:MoveNext() then
end return e.Current
end end
end end
"; end
";
#region Globals auto-complete
/// <summary> #region Globals auto-complete
/// An alphabetically sorted list of all globals (objects, methods, etc.) externally added to this Lua instance /// <summary>
/// </summary> /// An alphabetically sorted list of all globals (objects, methods, etc.) externally added to this Lua instance
/// <remarks>Members of globals are also listed. The formatting is optimized for text input auto-completion.</remarks> /// </summary>
public IEnumerable<string> Globals { /// <remarks>Members of globals are also listed. The formatting is optimized for text input auto-completion.</remarks>
get { public IEnumerable<string> Globals {
// Only sort list when necessary get {
if (!globalsSorted) { // Only sort list when necessary
globals.Sort (); if (!globalsSorted) {
globalsSorted = true; globals.Sort ();
} globalsSorted = true;
}
return globals;
} return globals;
} }
#endregion }
#endregion
public Lua ()
{ public Lua ()
luaState = LuaLib.LuaLNewState (); {
LuaLib.LuaLOpenLibs (luaState); luaState = LuaLib.LuaLNewState ();
Init (); LuaLib.LuaLOpenLibs (luaState);
// We need to keep this in a managed reference so the delegate doesn't get garbage collected Init ();
panicCallback = new LuaNativeFunction (PanicCallback); // We need to keep this in a managed reference so the delegate doesn't get garbage collected
LuaLib.LuaAtPanic (luaState, panicCallback); panicCallback = new LuaNativeFunction (PanicCallback);
} LuaLib.LuaAtPanic (luaState, panicCallback);
}
/*
* CAUTION: NLua.Lua instances can't share the same lua state! /*
*/ * CAUTION: NLua.Lua instances can't share the same lua state!
public Lua (LuaState lState) */
{ public Lua (LuaState lState)
LuaLib.LuaPushString (lState, "LUAINTERFACE LOADED"); {
LuaLib.LuaGetTable (lState, (int)LuaIndexes.Registry); LuaLib.LuaPushString (lState, "LUAINTERFACE LOADED");
LuaLib.LuaGetTable (lState, (int)LuaIndexes.Registry);
if (LuaLib.LuaToBoolean (lState, -1)) {
LuaLib.LuaSetTop (lState, -2); if (LuaLib.LuaToBoolean (lState, -1)) {
throw new LuaException ("There is already a NLua.Lua instance associated with this Lua state"); LuaLib.LuaSetTop (lState, -2);
} else { throw new LuaException ("There is already a NLua.Lua instance associated with this Lua state");
luaState = lState; } else {
_StatePassed = true; luaState = lState;
LuaLib.LuaSetTop (luaState, -2); _StatePassed = true;
Init (); LuaLib.LuaSetTop (luaState, -2);
} Init ();
} }
}
void Init ()
{ void Init ()
LuaLib.LuaPushString (luaState, "LUAINTERFACE LOADED"); {
LuaLib.LuaPushBoolean (luaState, true); LuaLib.LuaPushString (luaState, "LUAINTERFACE LOADED");
LuaLib.LuaSetTable (luaState, (int)LuaIndexes.Registry); LuaLib.LuaPushBoolean (luaState, true);
if (_StatePassed == false) { LuaLib.LuaSetTable (luaState, (int)LuaIndexes.Registry);
LuaLib.LuaNewTable (luaState); if (_StatePassed == false) {
LuaLib.LuaSetGlobal (luaState, "luanet"); LuaLib.LuaNewTable (luaState);
} LuaLib.LuaSetGlobal (luaState, "luanet");
LuaLib.LuaNetPushGlobalTable (luaState); }
LuaLib.LuaGetGlobal (luaState, "luanet"); LuaLib.LuaNetPushGlobalTable (luaState);
LuaLib.LuaPushString (luaState, "getmetatable"); LuaLib.LuaGetGlobal (luaState, "luanet");
LuaLib.LuaGetGlobal (luaState, "getmetatable"); LuaLib.LuaPushString (luaState, "getmetatable");
LuaLib.LuaSetTable (luaState, -3); LuaLib.LuaGetGlobal (luaState, "getmetatable");
LuaLib.LuaNetPopGlobalTable (luaState); LuaLib.LuaSetTable (luaState, -3);
translator = new ObjectTranslator (this, luaState); LuaLib.LuaNetPopGlobalTable (luaState);
ObjectTranslatorPool.Instance.Add (luaState, translator); translator = new ObjectTranslator (this, luaState);
LuaLib.LuaNetPopGlobalTable (luaState); ObjectTranslatorPool.Instance.Add (luaState, translator);
LuaLib.LuaLDoString (luaState, Lua.initLuanet); LuaLib.LuaNetPopGlobalTable (luaState);
} LuaLib.LuaLDoString (luaState, Lua.initLuanet);
}
public void Close ()
{ public void Close ()
if (_StatePassed) {
return; if (_StatePassed)
return;
if (! CheckNull.IsNull(luaState)) {
LuaCore.LuaClose (luaState); if (! CheckNull.IsNull(luaState)) {
ObjectTranslatorPool.Instance.Remove (luaState); LuaCore.LuaClose (luaState);
} ObjectTranslatorPool.Instance.Remove (luaState);
} }
}
#if MONOTOUCH
[MonoTouch.MonoPInvokeCallback (typeof (LuaNativeFunction))] #if MONOTOUCH
#endif [MonoPInvokeCallback (typeof (LuaNativeFunction))]
static int PanicCallback (LuaState luaState) #endif
{ static int PanicCallback (LuaState luaState)
string reason = string.Format ("unprotected error in call to Lua API ({0})", LuaLib.LuaToString (luaState, -1)); {
throw new LuaException (reason); string reason = string.Format ("unprotected error in call to Lua API ({0})", LuaLib.LuaToString (luaState, -1));
} throw new LuaException (reason);
}
/// <summary>
/// Assuming we have a Lua error string sitting on the stack, throw a C# exception out to the user's app /// <summary>
/// </summary> /// Assuming we have a Lua error string sitting on the stack, throw a C# exception out to the user's app
/// <exception cref = "LuaScriptException">Thrown if the script caused an exception</exception> /// </summary>
private void ThrowExceptionFromError (int oldTop) /// <exception cref = "LuaScriptException">Thrown if the script caused an exception</exception>
{ private void ThrowExceptionFromError (int oldTop)
object err = translator.GetObject (luaState, -1); {
LuaLib.LuaSetTop (luaState, oldTop); object err = translator.GetObject (luaState, -1);
LuaLib.LuaSetTop (luaState, oldTop);
// A pre-wrapped exception - just rethrow it (stack trace of InnerException will be preserved)
var luaEx = err as LuaScriptException; // A pre-wrapped exception - just rethrow it (stack trace of InnerException will be preserved)
var luaEx = err as LuaScriptException;
if (luaEx != null)
throw luaEx; if (luaEx != null)
throw luaEx;
// A non-wrapped Lua error (best interpreted as a string) - wrap it and throw it
if (err == null) // A non-wrapped Lua error (best interpreted as a string) - wrap it and throw it
err = "Unknown Lua Error"; if (err == null)
err = "Unknown Lua Error";
throw new LuaScriptException (err.ToString (), string.Empty);
} throw new LuaScriptException (err.ToString (), string.Empty);
}
/// <summary>
/// Convert C# exceptions into Lua errors /// <summary>
/// </summary> /// Convert C# exceptions into Lua errors
/// <returns>num of things on stack</returns> /// </summary>
/// <param name = "e">null for no pending exception</param> /// <returns>num of things on stack</returns>
internal int SetPendingException (Exception e) /// <param name = "e">null for no pending exception</param>
{ internal int SetPendingException (Exception e)
var caughtExcept = e; {
var caughtExcept = e;
if (caughtExcept != null) {
translator.ThrowError (luaState, caughtExcept); if (caughtExcept != null) {
LuaLib.LuaPushNil (luaState); translator.ThrowError (luaState, caughtExcept);
return 1; LuaLib.LuaPushNil (luaState);
} else return 1;
return 0; } else
} return 0;
}
/// <summary>
/// /// <summary>
/// </summary> ///
/// <param name = "chunk"></param> /// </summary>
/// <param name = "name"></param> /// <param name = "chunk"></param>
/// <returns></returns> /// <param name = "name"></param>
public LuaFunction LoadString (string chunk, string name) /// <returns></returns>
{ public LuaFunction LoadString (string chunk, string name)
int oldTop = LuaLib.LuaGetTop (luaState); {
executing = true; int oldTop = LuaLib.LuaGetTop (luaState);
executing = true;
try {
if (LuaLib.LuaLLoadBuffer (luaState, chunk, name) != 0) try {
ThrowExceptionFromError (oldTop); if (LuaLib.LuaLLoadBuffer (luaState, chunk, name) != 0)
} finally { ThrowExceptionFromError (oldTop);
executing = false; } finally {
} executing = false;
}
var result = translator.GetFunction (luaState, -1);
translator.PopValues (luaState, oldTop); var result = translator.GetFunction (luaState, -1);
return result; translator.PopValues (luaState, oldTop);
} return result;
}
/// <summary>
/// /// <summary>
/// </summary> ///
/// <param name = "chunk"></param> /// </summary>
/// <param name = "name"></param> /// <param name = "chunk"></param>
/// <returns></returns> /// <param name = "name"></param>
public LuaFunction LoadString (byte[] chunk, string name) /// <returns></returns>
{ public LuaFunction LoadString (byte[] chunk, string name)
int oldTop = LuaLib.LuaGetTop (luaState); {
executing = true; int oldTop = LuaLib.LuaGetTop (luaState);
executing = true;
try {
if (LuaLib.LuaLLoadBuffer (luaState, chunk, name) != 0) try {
ThrowExceptionFromError (oldTop); if (LuaLib.LuaLLoadBuffer (luaState, chunk, name) != 0)
} finally { ThrowExceptionFromError (oldTop);
executing = false; } finally {
} executing = false;
}
var result = translator.GetFunction (luaState, -1);
translator.PopValues (luaState, oldTop); var result = translator.GetFunction (luaState, -1);
return result; translator.PopValues (luaState, oldTop);
} return result;
}
/// <summary>
/// Load a File on, and return a LuaFunction to execute the file loaded (useful to see if the syntax of a file is ok) /// <summary>
/// </summary> /// Load a File on, and return a LuaFunction to execute the file loaded (useful to see if the syntax of a file is ok)
/// <param name = "fileName"></param> /// </summary>
/// <returns></returns> /// <param name = "fileName"></param>
public LuaFunction LoadFile (string fileName) /// <returns></returns>
{ public LuaFunction LoadFile (string fileName)
int oldTop = LuaLib.LuaGetTop (luaState); {
int oldTop = LuaLib.LuaGetTop (luaState);
if (LuaLib.LuaLLoadFile (luaState, fileName) != 0)
ThrowExceptionFromError (oldTop); if (LuaLib.LuaLLoadFile (luaState, fileName) != 0)
ThrowExceptionFromError (oldTop);
var result = translator.GetFunction (luaState, -1);
translator.PopValues (luaState, oldTop); var result = translator.GetFunction (luaState, -1);
return result; translator.PopValues (luaState, oldTop);
} return result;
}
/// <summary>
/// Executes a Lua chunk and returns all the chunk's return values in an array. /// <summary>
/// </summary> /// Executes a Lua chunk and returns all the chunk's return values in an array.
/// <param name = "chunk">Chunk to execute</param> /// </summary>
/// <param name = "chunkName">Name to associate with the chunk. Defaults to "chunk".</param> /// <param name = "chunk">Chunk to execute</param>
/// <returns></returns> /// <param name = "chunkName">Name to associate with the chunk. Defaults to "chunk".</param>
public object[] DoString (byte[] chunk, string chunkName = "chunk") /// <returns></returns>
{ public object[] DoString (byte[] chunk, string chunkName = "chunk")
int oldTop = LuaLib.LuaGetTop(luaState); {
executing = true; int oldTop = LuaLib.LuaGetTop(luaState);
executing = true;
if (LuaLib.LuaLLoadBuffer(luaState, chunk, chunkName) == 0)
{ if (LuaLib.LuaLLoadBuffer(luaState, chunk, chunkName) == 0)
try {
{ try
if (LuaLib.LuaPCall(luaState, 0, -1, 0) == 0) {
return translator.PopValues(luaState, oldTop); if (LuaLib.LuaPCall(luaState, 0, -1, 0) == 0)
else return translator.PopValues(luaState, oldTop);
ThrowExceptionFromError(oldTop); else
} ThrowExceptionFromError(oldTop);
finally }
{ finally
executing = false; {
} executing = false;
} }
else }
ThrowExceptionFromError(oldTop); else
ThrowExceptionFromError(oldTop);
return null; // Never reached - keeps compiler happy
} return null; // Never reached - keeps compiler happy
}
/// <summary>
/// Executes a Lua chunk and returns all the chunk's return values in an array. /// <summary>
/// </summary> /// Executes a Lua chunk and returns all the chunk's return values in an array.
/// <param name = "chunk">Chunk to execute</param> /// </summary>
/// <param name = "chunkName">Name to associate with the chunk. Defaults to "chunk".</param> /// <param name = "chunk">Chunk to execute</param>
/// <returns></returns> /// <param name = "chunkName">Name to associate with the chunk. Defaults to "chunk".</param>
public object[] DoString (string chunk, string chunkName = "chunk") /// <returns></returns>
{ public object[] DoString (string chunk, string chunkName = "chunk")
int oldTop = LuaLib.LuaGetTop(luaState); {
executing = true; int oldTop = LuaLib.LuaGetTop(luaState);
executing = true;
if (LuaLib.LuaLLoadBuffer(luaState, chunk, chunkName) == 0)
{ if (LuaLib.LuaLLoadBuffer(luaState, chunk, chunkName) == 0)
try {
{ try
if (LuaLib.LuaPCall(luaState, 0, -1, 0) == 0) {
return translator.PopValues(luaState, oldTop); if (LuaLib.LuaPCall(luaState, 0, -1, 0) == 0)
else return translator.PopValues(luaState, oldTop);
ThrowExceptionFromError(oldTop); else
} ThrowExceptionFromError(oldTop);
finally }
{ finally
executing = false; {
} executing = false;
} }
else }
ThrowExceptionFromError(oldTop); else
ThrowExceptionFromError(oldTop);
return null; // Never reached - keeps compiler happy
} return null; // Never reached - keeps compiler happy
}
/*
* Excutes a Lua file and returns all the chunk's return /*
* values in an array * Excutes a Lua file and returns all the chunk's return
*/ * values in an array
public object[] DoFile (string fileName) */
{ public object[] DoFile (string fileName)
int oldTop = LuaLib.LuaGetTop (luaState); {
int oldTop = LuaLib.LuaGetTop (luaState);
if (LuaLib.LuaLLoadFile (luaState, fileName) == 0) {
executing = true; if (LuaLib.LuaLLoadFile (luaState, fileName) == 0) {
executing = true;
try {
if (LuaLib.LuaPCall (luaState, 0, -1, 0) == 0) try {
return translator.PopValues (luaState, oldTop); if (LuaLib.LuaPCall (luaState, 0, -1, 0) == 0)
else return translator.PopValues (luaState, oldTop);
ThrowExceptionFromError (oldTop); else
} finally { ThrowExceptionFromError (oldTop);
executing = false; } finally {
} executing = false;
} else }
ThrowExceptionFromError (oldTop); } else
ThrowExceptionFromError (oldTop);
return null; // Never reached - keeps compiler happy
} return null; // Never reached - keeps compiler happy
}
/*
* Indexer for global variables from the LuaInterpreter /*
* Supports navigation of tables by using . operator * Indexer for global variables from the LuaInterpreter
*/ * Supports navigation of tables by using . operator
public object this [string fullPath] { */
get { public object this [string fullPath] {
object returnValue = null; get {
int oldTop = LuaLib.LuaGetTop (luaState); object returnValue = null;
string [] path = FullPathToArray (fullPath); int oldTop = LuaLib.LuaGetTop (luaState);
LuaLib.LuaGetGlobal (luaState, path [0]); string [] path = FullPathToArray (fullPath);
returnValue = translator.GetObject (luaState, -1); LuaLib.LuaGetGlobal (luaState, path [0]);
LuaBase dispose = null; returnValue = translator.GetObject (luaState, -1);
LuaBase dispose = null;
if (path.Length > 1) {
dispose = returnValue as LuaBase; if (path.Length > 1) {
string[] remainingPath = new string[path.Length - 1]; dispose = returnValue as LuaBase;
Array.Copy (path, 1, remainingPath, 0, path.Length - 1); string[] remainingPath = new string[path.Length - 1];
returnValue = GetObject (remainingPath); Array.Copy (path, 1, remainingPath, 0, path.Length - 1);
if (dispose != null) returnValue = GetObject (remainingPath);
dispose.Dispose (); if (dispose != null)
} dispose.Dispose ();
}
LuaLib.LuaSetTop (luaState, oldTop);
return returnValue; LuaLib.LuaSetTop (luaState, oldTop);
} return returnValue;
set { }
int oldTop = LuaLib.LuaGetTop (luaState); set {
string [] path = FullPathToArray (fullPath); int oldTop = LuaLib.LuaGetTop (luaState);
if (path.Length == 1) { string [] path = FullPathToArray (fullPath);
translator.Push (luaState, value); if (path.Length == 1) {
LuaLib.LuaSetGlobal (luaState, fullPath); translator.Push (luaState, value);
} else { LuaLib.LuaSetGlobal (luaState, fullPath);
LuaLib.LuaGetGlobal (luaState, path [0]); } else {
string[] remainingPath = new string[path.Length - 1]; LuaLib.LuaGetGlobal (luaState, path [0]);
Array.Copy (path, 1, remainingPath, 0, path.Length - 1); string[] remainingPath = new string[path.Length - 1];
SetObject (remainingPath, value); Array.Copy (path, 1, remainingPath, 0, path.Length - 1);
} SetObject (remainingPath, value);
}
LuaLib.LuaSetTop (luaState, oldTop);
LuaLib.LuaSetTop (luaState, oldTop);
// Globals auto-complete
if (value == null) { // Globals auto-complete
// Remove now obsolete entries if (value == null) {
globals.Remove (fullPath); // Remove now obsolete entries
} else { globals.Remove (fullPath);
// Add new entries } else {
if (!globals.Contains (fullPath)) // Add new entries
RegisterGlobal (fullPath, value.GetType (), 0); if (!globals.Contains (fullPath))
} RegisterGlobal (fullPath, value.GetType (), 0);
} }
} }
}
#region Globals auto-complete
/// <summary> #region Globals auto-complete
/// Adds an entry to <see cref = "globals"/> (recursivley handles 2 levels of members) /// <summary>
/// </summary> /// Adds an entry to <see cref = "globals"/> (recursivley handles 2 levels of members)
/// <param name = "path">The index accessor path ot the entry</param> /// </summary>
/// <param name = "type">The type of the entry</param> /// <param name = "path">The index accessor path ot the entry</param>
/// <param name = "recursionCounter">How deep have we gone with recursion?</param> /// <param name = "type">The type of the entry</param>
private void RegisterGlobal (string path, Type type, int recursionCounter) /// <param name = "recursionCounter">How deep have we gone with recursion?</param>
{ private void RegisterGlobal (string path, Type type, int recursionCounter)
// If the type is a global method, list it directly {
if (type == typeof(LuaNativeFunction)) { // If the type is a global method, list it directly
// Format for easy method invocation if (type == typeof(LuaNativeFunction)) {
globals.Add (path + "("); // Format for easy method invocation
} globals.Add (path + "(");
// If the type is a class or an interface and recursion hasn't been running too long, list the members }
else if ((type.IsClass () || type.IsInterface ()) && type != typeof(string) && recursionCounter < 2) { // If the type is a class or an interface and recursion hasn't been running too long, list the members
#region Methods else if ((type.IsClass () || type.IsInterface ()) && type != typeof(string) && recursionCounter < 2) {
foreach (var method in type.GetMethods(BindingFlags.Public | BindingFlags.Instance)) { #region Methods
string name = method.Name; foreach (var method in type.GetMethods(BindingFlags.Public | BindingFlags.Instance)) {
if ( string name = method.Name;
// Check that the LuaHideAttribute and LuaGlobalAttribute were not applied if (
(!method.GetCustomAttributes (typeof(LuaHideAttribute), false).Any ()) && // Check that the LuaHideAttribute and LuaGlobalAttribute were not applied
(!method.GetCustomAttributes (typeof(LuaGlobalAttribute), false).Any ()) && (!method.GetCustomAttributes (typeof(LuaHideAttribute), false).Any ()) &&
// Exclude some generic .NET methods that wouldn't be very usefull in Lua (!method.GetCustomAttributes (typeof(LuaGlobalAttribute), false).Any ()) &&
name != "GetType" && name != "GetHashCode" && name != "Equals" && // Exclude some generic .NET methods that wouldn't be very usefull in Lua
name != "ToString" && name != "Clone" && name != "Dispose" && name != "GetType" && name != "GetHashCode" && name != "Equals" &&
name != "GetEnumerator" && name != "CopyTo" && name != "ToString" && name != "Clone" && name != "Dispose" &&
!name.StartsWith ("get_", StringComparison.Ordinal) && name != "GetEnumerator" && name != "CopyTo" &&
!name.StartsWith ("set_", StringComparison.Ordinal) && !name.StartsWith ("get_", StringComparison.Ordinal) &&
!name.StartsWith ("add_", StringComparison.Ordinal) && !name.StartsWith ("set_", StringComparison.Ordinal) &&
!name.StartsWith ("remove_", StringComparison.Ordinal)) { !name.StartsWith ("add_", StringComparison.Ordinal) &&
// Format for easy method invocation !name.StartsWith ("remove_", StringComparison.Ordinal)) {
string command = path + ":" + name + "("; // Format for easy method invocation
string command = path + ":" + name + "(";
if (method.GetParameters ().Length == 0)
command += ")"; if (method.GetParameters ().Length == 0)
globals.Add (command); command += ")";
} globals.Add (command);
} }
#endregion }
#endregion
#region Fields
foreach (var field in type.GetFields(BindingFlags.Public | BindingFlags.Instance)) { #region Fields
if ( foreach (var field in type.GetFields(BindingFlags.Public | BindingFlags.Instance)) {
// Check that the LuaHideAttribute and LuaGlobalAttribute were not applied if (
(!field.GetCustomAttributes (typeof(LuaHideAttribute), false).Any ()) && // Check that the LuaHideAttribute and LuaGlobalAttribute were not applied
(!field.GetCustomAttributes (typeof(LuaGlobalAttribute), false).Any ())) { (!field.GetCustomAttributes (typeof(LuaHideAttribute), false).Any ()) &&
// Go into recursion for members (!field.GetCustomAttributes (typeof(LuaGlobalAttribute), false).Any ())) {
RegisterGlobal (path + "." + field.Name, field.FieldType, recursionCounter + 1); // Go into recursion for members
} RegisterGlobal (path + "." + field.Name, field.FieldType, recursionCounter + 1);
} }
#endregion }
#endregion
#region Properties
foreach (var property in type.GetProperties (BindingFlags.Public | BindingFlags.Instance)) { #region Properties
if ( foreach (var property in type.GetProperties (BindingFlags.Public | BindingFlags.Instance)) {
// Check that the LuaHideAttribute and LuaGlobalAttribute were not applied if (
(!property.GetCustomAttributes (typeof(LuaHideAttribute), false).Any ()) && // Check that the LuaHideAttribute and LuaGlobalAttribute were not applied
(!property.GetCustomAttributes (typeof(LuaGlobalAttribute), false).Any ()) (!property.GetCustomAttributes (typeof(LuaHideAttribute), false).Any ()) &&
// Exclude some generic .NET properties that wouldn't be very useful in Lua (!property.GetCustomAttributes (typeof(LuaGlobalAttribute), false).Any ())
&& property.Name != "Item") { // Exclude some generic .NET properties that wouldn't be very useful in Lua
// Go into recursion for members && property.Name != "Item") {
RegisterGlobal (path + "." + property.Name, property.PropertyType, recursionCounter + 1); // Go into recursion for members
} RegisterGlobal (path + "." + property.Name, property.PropertyType, recursionCounter + 1);
} }
#endregion }
} else #endregion
globals.Add (path); // Otherwise simply add the element to the list } else
globals.Add (path); // Otherwise simply add the element to the list
// List will need to be sorted on next access
globalsSorted = false; // List will need to be sorted on next access
} globalsSorted = false;
#endregion }
#endregion
/*
* Navigates a table in the top of the stack, returning /*
* the value of the specified field * Navigates a table in the top of the stack, returning
*/ * the value of the specified field
object GetObject (string[] remainingPath) */
{ object GetObject (string[] remainingPath)
object returnValue = null; {
object returnValue = null;
for (int i = 0; i < remainingPath.Length; i++) {
LuaLib.LuaPushString (luaState, remainingPath [i]); for (int i = 0; i < remainingPath.Length; i++) {
LuaLib.LuaGetTable (luaState, -2); LuaLib.LuaPushString (luaState, remainingPath [i]);
returnValue = translator.GetObject (luaState, -1); LuaLib.LuaGetTable (luaState, -2);
returnValue = translator.GetObject (luaState, -1);
if (returnValue == null)
break; if (returnValue == null)
} break;
}
return returnValue;
} return returnValue;
}
/*
* Gets a numeric global variable /*
*/ * Gets a numeric global variable
public double GetNumber (string fullPath) */
{ public double GetNumber (string fullPath)
return (double)this [fullPath]; {
} return (double)this [fullPath];
}
/*
* Gets a string global variable /*
*/ * Gets a string global variable
public string GetString (string fullPath) */
{ public string GetString (string fullPath)
return this [fullPath].ToString (); {
} return this [fullPath].ToString ();
}
/*
* Gets a table global variable /*
*/ * Gets a table global variable
public LuaTable GetTable (string fullPath) */
{ public LuaTable GetTable (string fullPath)
return (LuaTable)this [fullPath]; {
} return (LuaTable)this [fullPath];
}
/*
* Gets a table global variable as an object implementing /*
* the interfaceType interface * Gets a table global variable as an object implementing
*/ * the interfaceType interface
public object GetTable (Type interfaceType, string fullPath) */
{ public object GetTable (Type interfaceType, string fullPath)
return CodeGeneration.Instance.GetClassInstance (interfaceType, GetTable (fullPath)); {
} return CodeGeneration.Instance.GetClassInstance (interfaceType, GetTable (fullPath));
}
/*
* Gets a function global variable /*
*/ * Gets a function global variable
public LuaFunction GetFunction (string fullPath) */
{ public LuaFunction GetFunction (string fullPath)
object obj = this [fullPath]; {
return (obj is LuaNativeFunction ? new LuaFunction ((LuaNativeFunction)obj, this) : (LuaFunction)obj); object obj = this [fullPath];
} return (obj is LuaNativeFunction ? new LuaFunction ((LuaNativeFunction)obj, this) : (LuaFunction)obj);
}
/*
* Register a delegate type to be used to convert Lua functions to C# delegates (useful for iOS where there is no dynamic code generation) /*
* type delegateType * Register a delegate type to be used to convert Lua functions to C# delegates (useful for iOS where there is no dynamic code generation)
*/ * type delegateType
public void RegisterLuaDelegateType (Type delegateType, Type luaDelegateType) */
{ public void RegisterLuaDelegateType (Type delegateType, Type luaDelegateType)
CodeGeneration.Instance.RegisterLuaDelegateType (delegateType, luaDelegateType); {
} CodeGeneration.Instance.RegisterLuaDelegateType (delegateType, luaDelegateType);
}
public void RegisterLuaClassType (Type klass, Type luaClass)
{ public void RegisterLuaClassType (Type klass, Type luaClass)
CodeGeneration.Instance.RegisterLuaClassType (klass, luaClass); {
} CodeGeneration.Instance.RegisterLuaClassType (klass, luaClass);
}
public void LoadCLRPackage ()
{ public void LoadCLRPackage ()
LuaLib.LuaLDoString (luaState, Lua.clr_package); {
} LuaLib.LuaLDoString (luaState, Lua.clr_package);
/* }
* Gets a function global variable as a delegate of /*
* type delegateType * Gets a function global variable as a delegate of
*/ * type delegateType
public Delegate GetFunction (Type delegateType, string fullPath) */
{ public Delegate GetFunction (Type delegateType, string fullPath)
return CodeGeneration.Instance.GetDelegate (delegateType, GetFunction (fullPath)); {
} return CodeGeneration.Instance.GetDelegate (delegateType, GetFunction (fullPath));
}
/*
* Calls the object as a function with the provided arguments, /*
* returning the function's returned values inside an array * Calls the object as a function with the provided arguments,
*/ * returning the function's returned values inside an array
internal object[] CallFunction (object function, object[] args) */
{ internal object[] CallFunction (object function, object[] args)
return CallFunction (function, args, null); {
} return CallFunction (function, args, null);
}
/*
* Calls the object as a function with the provided arguments and /*
* casting returned values to the types in returnTypes before returning * Calls the object as a function with the provided arguments and
* them in an array * casting returned values to the types in returnTypes before returning
*/ * them in an array
internal object[] CallFunction (object function, object[] args, Type[] returnTypes) */
{ internal object[] CallFunction (object function, object[] args, Type[] returnTypes)
int nArgs = 0; {
int oldTop = LuaLib.LuaGetTop (luaState); int nArgs = 0;
int oldTop = LuaLib.LuaGetTop (luaState);
if (!LuaLib.LuaCheckStack (luaState, args.Length + 6))
throw new LuaException ("Lua stack overflow"); if (!LuaLib.LuaCheckStack (luaState, args.Length + 6))
throw new LuaException ("Lua stack overflow");
translator.Push (luaState, function);
translator.Push (luaState, function);
if (args != null) {
nArgs = args.Length; if (args != null) {
nArgs = args.Length;
for (int i = 0; i < args.Length; i++)
translator.Push (luaState, args [i]); for (int i = 0; i < args.Length; i++)
} translator.Push (luaState, args [i]);
}
executing = true;
executing = true;
try {
int error = LuaLib.LuaPCall (luaState, nArgs, -1, 0); try {
if (error != 0) int error = LuaLib.LuaPCall (luaState, nArgs, -1, 0);
ThrowExceptionFromError (oldTop); if (error != 0)
} finally { ThrowExceptionFromError (oldTop);
executing = false; } finally {
} executing = false;
}
return returnTypes != null ? translator.PopValues (luaState, oldTop, returnTypes) : translator.PopValues (luaState, oldTop);
} return returnTypes != null ? translator.PopValues (luaState, oldTop, returnTypes) : translator.PopValues (luaState, oldTop);
}
/*
* Navigates a table to set the value of one of its fields /*
*/ * Navigates a table to set the value of one of its fields
void SetObject (string[] remainingPath, object val) */
{ void SetObject (string[] remainingPath, object val)
for (int i = 0; i < remainingPath.Length-1; i++) { {
LuaLib.LuaPushString (luaState, remainingPath [i]); for (int i = 0; i < remainingPath.Length-1; i++) {
LuaLib.LuaGetTable (luaState, -2); LuaLib.LuaPushString (luaState, remainingPath [i]);
} LuaLib.LuaGetTable (luaState, -2);
}
LuaLib.LuaPushString (luaState, remainingPath [remainingPath.Length - 1]);
translator.Push (luaState, val); LuaLib.LuaPushString (luaState, remainingPath [remainingPath.Length - 1]);
LuaLib.LuaSetTable (luaState, -3); translator.Push (luaState, val);
} LuaLib.LuaSetTable (luaState, -3);
}
string [] FullPathToArray (string fullPath)
{ string [] FullPathToArray (string fullPath)
return fullPath.SplitWithEscape ('.', '\\').ToArray (); {
} return fullPath.SplitWithEscape ('.', '\\').ToArray ();
/* }
* Creates a new table as a global variable or as a field /*
* inside an existing table * Creates a new table as a global variable or as a field
*/ * inside an existing table
public void NewTable (string fullPath) */
{ public void NewTable (string fullPath)
string [] path = FullPathToArray (fullPath); {
int oldTop = LuaLib.LuaGetTop (luaState); string [] path = FullPathToArray (fullPath);
int oldTop = LuaLib.LuaGetTop (luaState);
if (path.Length == 1) {
LuaLib.LuaNewTable (luaState); if (path.Length == 1) {
LuaLib.LuaSetGlobal (luaState, fullPath); LuaLib.LuaNewTable (luaState);
} else { LuaLib.LuaSetGlobal (luaState, fullPath);
LuaLib.LuaGetGlobal (luaState, path [0]); } else {
LuaLib.LuaGetGlobal (luaState, path [0]);
for (int i = 1; i < path.Length-1; i++) {
LuaLib.LuaPushString (luaState, path [i]); for (int i = 1; i < path.Length-1; i++) {
LuaLib.LuaGetTable (luaState, -2); LuaLib.LuaPushString (luaState, path [i]);
} LuaLib.LuaGetTable (luaState, -2);
}
LuaLib.LuaPushString (luaState, path [path.Length - 1]);
LuaLib.LuaNewTable (luaState); LuaLib.LuaPushString (luaState, path [path.Length - 1]);
LuaLib.LuaSetTable (luaState, -3); LuaLib.LuaNewTable (luaState);
} LuaLib.LuaSetTable (luaState, -3);
}
LuaLib.LuaSetTop (luaState, oldTop);
} LuaLib.LuaSetTop (luaState, oldTop);
}
public Dictionary<object, object> GetTableDict (LuaTable table)
{ public Dictionary<object, object> GetTableDict (LuaTable table)
var dict = new Dictionary<object, object> (); {
int oldTop = LuaLib.LuaGetTop (luaState); var dict = new Dictionary<object, object> ();
translator.Push (luaState, table); int oldTop = LuaLib.LuaGetTop (luaState);
LuaLib.LuaPushNil (luaState); translator.Push (luaState, table);
LuaLib.LuaPushNil (luaState);
while (LuaLib.LuaNext(luaState, -2) != 0) {
dict [translator.GetObject (luaState, -2)] = translator.GetObject (luaState, -1); while (LuaLib.LuaNext(luaState, -2) != 0) {
LuaLib.LuaSetTop (luaState, -2); dict [translator.GetObject (luaState, -2)] = translator.GetObject (luaState, -1);
} LuaLib.LuaSetTop (luaState, -2);
}
LuaLib.LuaSetTop (luaState, oldTop);
return dict; LuaLib.LuaSetTop (luaState, oldTop);
} return dict;
}
/*
* Lets go of a previously allocated reference to a table, function /*
* or userdata * Lets go of a previously allocated reference to a table, function
*/ * or userdata
#region lua debug functions */
/// <summary> #region lua debug functions
/// Activates the debug hook /// <summary>
/// </summary> /// Activates the debug hook
/// <param name = "mask">Mask</param> /// </summary>
/// <param name = "count">Count</param> /// <param name = "mask">Mask</param>
/// <returns>see lua docs. -1 if hook is already set</returns> /// <param name = "count">Count</param>
public int SetDebugHook (EventMasks mask, int count) /// <returns>see lua docs. -1 if hook is already set</returns>
{ public int SetDebugHook (EventMasks mask, int count)
if (hookCallback == null) { {
hookCallback = new LuaHook (Lua.DebugHookCallback); if (hookCallback == null) {
return LuaCore.LuaSetHook (luaState, hookCallback, (int)mask, count); hookCallback = new LuaHook (Lua.DebugHookCallback);
} return LuaCore.LuaSetHook (luaState, hookCallback, (int)mask, count);
}
return -1;
} return -1;
}
/// <summary>
/// Removes the debug hook /// <summary>
/// </summary> /// Removes the debug hook
/// <returns>see lua docs</returns> /// </summary>
public int RemoveDebugHook () /// <returns>see lua docs</returns>
{ public int RemoveDebugHook ()
hookCallback = null; {
return LuaCore.LuaSetHook (luaState, null, 0, 0); hookCallback = null;
} return LuaCore.LuaSetHook (luaState, null, 0, 0);
}
/// <summary>
/// Gets the hook mask. /// <summary>
/// </summary> /// Gets the hook mask.
/// <returns>hook mask</returns> /// </summary>
public EventMasks GetHookMask () /// <returns>hook mask</returns>
{ public EventMasks GetHookMask ()
return (EventMasks)LuaCore.LuaGetHookMask (luaState); {
} return (EventMasks)LuaCore.LuaGetHookMask (luaState);
}
/// <summary>
/// Gets the hook count /// <summary>
/// </summary> /// Gets the hook count
/// <returns>see lua docs</returns> /// </summary>
public int GetHookCount () /// <returns>see lua docs</returns>
{ public int GetHookCount ()
return LuaCore.LuaGetHookCount (luaState); {
} return LuaCore.LuaGetHookCount (luaState);
}
/// <summary>
/// Gets local (see lua docs) /// <summary>
/// </summary> /// Gets local (see lua docs)
/// <param name = "luaDebug">lua debug structure</param> /// </summary>
/// <param name = "n">see lua docs</param> /// <param name = "luaDebug">lua debug structure</param>
/// <returns>see lua docs</returns> /// <param name = "n">see lua docs</param>
public string GetLocal (LuaDebug luaDebug, int n) /// <returns>see lua docs</returns>
{ public string GetLocal (LuaDebug luaDebug, int n)
return LuaCore.LuaGetLocal (luaState, luaDebug, n).ToString (); {
} return LuaCore.LuaGetLocal (luaState, luaDebug, n).ToString ();
}
/// <summary>
/// Sets local (see lua docs) /// <summary>
/// </summary> /// Sets local (see lua docs)
/// <param name = "luaDebug">lua debug structure</param> /// </summary>
/// <param name = "n">see lua docs</param> /// <param name = "luaDebug">lua debug structure</param>
/// <returns>see lua docs</returns> /// <param name = "n">see lua docs</param>
public string SetLocal (LuaDebug luaDebug, int n) /// <returns>see lua docs</returns>
{ public string SetLocal (LuaDebug luaDebug, int n)
return LuaCore.LuaSetLocal (luaState, luaDebug, n).ToString (); {
} return LuaCore.LuaSetLocal (luaState, luaDebug, n).ToString ();
}
public int GetStack (int level, ref LuaDebug ar)
{ public int GetStack (int level, ref LuaDebug ar)
return LuaCore.LuaGetStack (luaState, level,ref ar); {
} return LuaCore.LuaGetStack (luaState, level,ref ar);
}
public int GetInfo (string what, ref LuaDebug ar)
{ public int GetInfo (string what, ref LuaDebug ar)
return LuaCore.LuaGetInfo (luaState, what, ref ar); {
} return LuaCore.LuaGetInfo (luaState, what, ref ar);
}
/// <summary>
/// Gets up value (see lua docs) /// <summary>
/// </summary> /// Gets up value (see lua docs)
/// <param name = "funcindex">see lua docs</param> /// </summary>
/// <param name = "n">see lua docs</param> /// <param name = "funcindex">see lua docs</param>
/// <returns>see lua docs</returns> /// <param name = "n">see lua docs</param>
public string GetUpValue (int funcindex, int n) /// <returns>see lua docs</returns>
{ public string GetUpValue (int funcindex, int n)
return LuaCore.LuaGetUpValue (luaState, funcindex, n).ToString (); {
} return LuaCore.LuaGetUpValue (luaState, funcindex, n).ToString ();
}
/// <summary>
/// Sets up value (see lua docs) /// <summary>
/// </summary> /// Sets up value (see lua docs)
/// <param name = "funcindex">see lua docs</param> /// </summary>
/// <param name = "n">see lua docs</param> /// <param name = "funcindex">see lua docs</param>
/// <returns>see lua docs</returns> /// <param name = "n">see lua docs</param>
public string SetUpValue (int funcindex, int n) /// <returns>see lua docs</returns>
{ public string SetUpValue (int funcindex, int n)
return LuaCore.LuaSetUpValue (luaState, funcindex, n).ToString (); {
} return LuaCore.LuaSetUpValue (luaState, funcindex, n).ToString ();
}
/// <summary>
/// Delegate that is called on lua hook callback /// <summary>
/// </summary> /// Delegate that is called on lua hook callback
/// <param name = "luaState">lua state</param> /// </summary>
/// <param name = "luaDebug">Pointer to LuaDebug (lua_debug) structure</param> /// <param name = "luaState">lua state</param>
/// /// <param name = "luaDebug">Pointer to LuaDebug (lua_debug) structure</param>
#if MONOTOUCH ///
[MonoTouch.MonoPInvokeCallback (typeof (LuaHook))] #if MONOTOUCH
#endif [MonoPInvokeCallback (typeof (LuaHook))]
#if USE_KOPILUA #endif
static void DebugHookCallback (LuaState luaState, LuaDebug debug) #if USE_KOPILUA
{ static void DebugHookCallback (LuaState luaState, LuaDebug debug)
#elif NETFX_CORE {
static void DebugHookCallback (LuaState luaState, long luaDebug) #elif NETFX_CORE
static void DebugHookCallback (LuaState luaState, long luaDebug)
{ {
IntPtr ptr = new IntPtr (luaDebug); IntPtr ptr = new IntPtr (luaDebug);
LuaDebug debug = System.Runtime.InteropServices.Marshal.PtrToStructure <LuaDebug> (ptr); LuaDebug debug = System.Runtime.InteropServices.Marshal.PtrToStructure <LuaDebug> (ptr);
#else #else
static void DebugHookCallback (LuaState luaState, IntPtr luaDebug) static void DebugHookCallback (LuaState luaState, IntPtr luaDebug)
{ {
LuaDebug debug = (LuaDebug)System.Runtime.InteropServices.Marshal.PtrToStructure (luaDebug, typeof (LuaDebug)); LuaDebug debug = (LuaDebug)System.Runtime.InteropServices.Marshal.PtrToStructure (luaDebug, typeof (LuaDebug));
#endif #endif
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find (luaState); ObjectTranslator translator = ObjectTranslatorPool.Instance.Find (luaState);
Lua lua = translator.Interpreter; Lua lua = translator.Interpreter;
lua.DebugHookCallbackInternal (luaState, debug); lua.DebugHookCallbackInternal (luaState, debug);
} }
private void DebugHookCallbackInternal (LuaState luaState, LuaDebug luaDebug) private void DebugHookCallbackInternal (LuaState luaState, LuaDebug luaDebug)
{ {
try { try {
var temp = DebugHook; var temp = DebugHook;
if (temp != null) if (temp != null)
temp (this, new DebugHookEventArgs (luaDebug)); temp (this, new DebugHookEventArgs (luaDebug));
} catch (Exception ex) { } catch (Exception ex) {
OnHookException (new HookExceptionEventArgs (ex)); OnHookException (new HookExceptionEventArgs (ex));
} }
} }
private void OnHookException (HookExceptionEventArgs e) private void OnHookException (HookExceptionEventArgs e)
{ {
var temp = HookException; var temp = HookException;
if (temp != null) if (temp != null)
temp (this, e); temp (this, e);
} }
/// <summary> /// <summary>
/// Pops a value from the lua stack. /// Pops a value from the lua stack.
/// </summary> /// </summary>
/// <returns>Returns the top value from the lua stack.</returns> /// <returns>Returns the top value from the lua stack.</returns>
public object Pop () public object Pop ()
{ {
int top = LuaLib.LuaGetTop (luaState); int top = LuaLib.LuaGetTop (luaState);
return translator.PopValues (luaState, top - 1) [0]; return translator.PopValues (luaState, top - 1) [0];
} }
/// <summary> /// <summary>
/// Pushes a value onto the lua stack. /// Pushes a value onto the lua stack.
/// </summary> /// </summary>
/// <param name = "value">Value to push.</param> /// <param name = "value">Value to push.</param>
public void Push (object value) public void Push (object value)
{ {
translator.Push (luaState, value); translator.Push (luaState, value);
} }
#endregion #endregion
internal void DisposeInternal (int reference) internal void DisposeInternal (int reference)
{ {
if (! CheckNull.IsNull(luaState)) //Fix submitted by Qingrui Li if (! CheckNull.IsNull(luaState)) //Fix submitted by Qingrui Li
LuaLib.LuaUnref (luaState, reference); LuaLib.LuaUnref (luaState, reference);
} }
/* /*
* Gets a field of the table corresponding to the provided reference * Gets a field of the table corresponding to the provided reference
* using rawget (do not use metatables) * using rawget (do not use metatables)
*/ */
internal object RawGetObject (int reference, string field) internal object RawGetObject (int reference, string field)
{ {
int oldTop = LuaLib.LuaGetTop (luaState); int oldTop = LuaLib.LuaGetTop (luaState);
LuaLib.LuaGetRef (luaState, reference); LuaLib.LuaGetRef (luaState, reference);
LuaLib.LuaPushString (luaState, field); LuaLib.LuaPushString (luaState, field);
LuaLib.LuaRawGet (luaState, -2); LuaLib.LuaRawGet (luaState, -2);
object obj = translator.GetObject (luaState, -1); object obj = translator.GetObject (luaState, -1);
LuaLib.LuaSetTop (luaState, oldTop); LuaLib.LuaSetTop (luaState, oldTop);
return obj; return obj;
} }
/* /*
* Gets a field of the table or userdata corresponding to the provided reference * Gets a field of the table or userdata corresponding to the provided reference
*/ */
internal object GetObject (int reference, string field) internal object GetObject (int reference, string field)
{ {
int oldTop = LuaLib.LuaGetTop (luaState); int oldTop = LuaLib.LuaGetTop (luaState);
LuaLib.LuaGetRef (luaState, reference); LuaLib.LuaGetRef (luaState, reference);
object returnValue = GetObject (FullPathToArray (field)); object returnValue = GetObject (FullPathToArray (field));
LuaLib.LuaSetTop (luaState, oldTop); LuaLib.LuaSetTop (luaState, oldTop);
return returnValue; return returnValue;
} }
/* /*
* Gets a numeric field of the table or userdata corresponding the the provided reference * Gets a numeric field of the table or userdata corresponding the the provided reference
*/ */
internal object GetObject (int reference, object field) internal object GetObject (int reference, object field)
{ {
int oldTop = LuaLib.LuaGetTop (luaState); int oldTop = LuaLib.LuaGetTop (luaState);
LuaLib.LuaGetRef (luaState, reference); LuaLib.LuaGetRef (luaState, reference);
translator.Push (luaState, field); translator.Push (luaState, field);
LuaLib.LuaGetTable (luaState, -2); LuaLib.LuaGetTable (luaState, -2);
object returnValue = translator.GetObject (luaState, -1); object returnValue = translator.GetObject (luaState, -1);
LuaLib.LuaSetTop (luaState, oldTop); LuaLib.LuaSetTop (luaState, oldTop);
return returnValue; return returnValue;
} }
/* /*
* Sets a field of the table or userdata corresponding the the provided reference * Sets a field of the table or userdata corresponding the the provided reference
* to the provided value * to the provided value
*/ */
internal void SetObject (int reference, string field, object val) internal void SetObject (int reference, string field, object val)
{ {
int oldTop = LuaLib.LuaGetTop (luaState); int oldTop = LuaLib.LuaGetTop (luaState);
LuaLib.LuaGetRef (luaState, reference); LuaLib.LuaGetRef (luaState, reference);
SetObject (FullPathToArray (field), val); SetObject (FullPathToArray (field), val);
LuaLib.LuaSetTop (luaState, oldTop); LuaLib.LuaSetTop (luaState, oldTop);
} }
/* /*
* Sets a numeric field of the table or userdata corresponding the the provided reference * Sets a numeric field of the table or userdata corresponding the the provided reference
* to the provided value * to the provided value
*/ */
internal void SetObject (int reference, object field, object val) internal void SetObject (int reference, object field, object val)
{ {
int oldTop = LuaLib.LuaGetTop (luaState); int oldTop = LuaLib.LuaGetTop (luaState);
LuaLib.LuaGetRef (luaState, reference); LuaLib.LuaGetRef (luaState, reference);
translator.Push (luaState, field); translator.Push (luaState, field);
translator.Push (luaState, val); translator.Push (luaState, val);
LuaLib.LuaSetTable (luaState, -3); LuaLib.LuaSetTable (luaState, -3);
LuaLib.LuaSetTop (luaState, oldTop); LuaLib.LuaSetTop (luaState, oldTop);
} }
public LuaFunction RegisterFunction (string path,MethodBase function /*MethodInfo function*/) public LuaFunction RegisterFunction (string path,MethodBase function /*MethodInfo function*/)
{ {
return RegisterFunction (path, null, function); return RegisterFunction (path, null, function);
} }
/* /*
* Registers an object's method as a Lua function (global or table field) * Registers an object's method as a Lua function (global or table field)
* The method may have any signature * The method may have any signature
*/ */
public LuaFunction RegisterFunction (string path, object target, MethodBase function /*MethodInfo function*/) //CP: Fix for struct constructor by Alexander Kappner (link: http://luaforge.net/forum/forum.php?thread_id = 2859&forum_id = 145) public LuaFunction RegisterFunction (string path, object target, MethodBase function /*MethodInfo function*/) //CP: Fix for struct constructor by Alexander Kappner (link: http://luaforge.net/forum/forum.php?thread_id = 2859&forum_id = 145)
{ {
// We leave nothing on the stack when we are done // We leave nothing on the stack when we are done
int oldTop = LuaLib.LuaGetTop (luaState); int oldTop = LuaLib.LuaGetTop (luaState);
var wrapper = new LuaMethodWrapper (translator, target, new ProxyType(function.DeclaringType), function); var wrapper = new LuaMethodWrapper (translator, target, new ProxyType(function.DeclaringType), function);
translator.Push (luaState, new LuaNativeFunction (wrapper.invokeFunction)); translator.Push (luaState, new LuaNativeFunction (wrapper.invokeFunction));
this [path] = translator.GetObject (luaState, -1); this [path] = translator.GetObject (luaState, -1);
var f = GetFunction (path); var f = GetFunction (path);
LuaLib.LuaSetTop (luaState, oldTop); LuaLib.LuaSetTop (luaState, oldTop);
return f; return f;
} }
/* /*
* Compares the two values referenced by ref1 and ref2 for equality * Compares the two values referenced by ref1 and ref2 for equality
*/ */
internal bool CompareRef (int ref1, int ref2) internal bool CompareRef (int ref1, int ref2)
{ {
int top = LuaLib.LuaGetTop (luaState); int top = LuaLib.LuaGetTop (luaState);
LuaLib.LuaGetRef (luaState, ref1); LuaLib.LuaGetRef (luaState, ref1);
LuaLib.LuaGetRef (luaState, ref2); LuaLib.LuaGetRef (luaState, ref2);
int equal = LuaLib.LuaEqual (luaState, -1, -2); int equal = LuaLib.LuaEqual (luaState, -1, -2);
LuaLib.LuaSetTop (luaState, top); LuaLib.LuaSetTop (luaState, top);
return (equal != 0); return (equal != 0);
} }
internal void PushCSFunction (LuaNativeFunction function) internal void PushCSFunction (LuaNativeFunction function)
{ {
translator.PushFunction (luaState, function); translator.PushFunction (luaState, function);
} }
#region IDisposable Members #region IDisposable Members
public virtual void Dispose () public virtual void Dispose ()
{ {
if (translator != null) { if (translator != null) {
translator.pendingEvents.Dispose (); translator.pendingEvents.Dispose ();
translator = null; translator = null;
} }
Close (); Close ();
GC.WaitForPendingFinalizers (); GC.WaitForPendingFinalizers ();
} }
#endregion #endregion
} }
} }
\ No newline at end of file
...@@ -32,6 +32,7 @@ using System.Collections.Generic; ...@@ -32,6 +32,7 @@ using System.Collections.Generic;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using NLua.Method; using NLua.Method;
using NLua.Extensions; using NLua.Extensions;
using ObjCRuntime;
namespace NLua namespace NLua
{ {
...@@ -126,7 +127,7 @@ namespace NLua ...@@ -126,7 +127,7 @@ namespace NLua
* __call metafunction of CLR delegates, retrieves and calls the delegate. * __call metafunction of CLR delegates, retrieves and calls the delegate.
*/ */
#if MONOTOUCH #if MONOTOUCH
[MonoTouch.MonoPInvokeCallback (typeof (LuaNativeFunction))] [MonoPInvokeCallback (typeof (LuaNativeFunction))]
#endif #endif
private static int RunFunctionDelegate (LuaState luaState) private static int RunFunctionDelegate (LuaState luaState)
{ {
...@@ -145,7 +146,7 @@ namespace NLua ...@@ -145,7 +146,7 @@ namespace NLua
* __gc metafunction of CLR objects. * __gc metafunction of CLR objects.
*/ */
#if MONOTOUCH #if MONOTOUCH
[MonoTouch.MonoPInvokeCallback (typeof (LuaNativeFunction))] [MonoPInvokeCallback (typeof (LuaNativeFunction))]
#endif #endif
private static int CollectObject (LuaState luaState) private static int CollectObject (LuaState luaState)
{ {
...@@ -167,7 +168,7 @@ namespace NLua ...@@ -167,7 +168,7 @@ namespace NLua
* __tostring metafunction of CLR objects. * __tostring metafunction of CLR objects.
*/ */
#if MONOTOUCH #if MONOTOUCH
[MonoTouch.MonoPInvokeCallback (typeof (LuaNativeFunction))] [MonoPInvokeCallback (typeof (LuaNativeFunction))]
#endif #endif
private static int ToStringLua (LuaState luaState) private static int ToStringLua (LuaState luaState)
{ {
...@@ -192,7 +193,7 @@ namespace NLua ...@@ -192,7 +193,7 @@ namespace NLua
* __add metafunction of CLR objects. * __add metafunction of CLR objects.
*/ */
#if MONOTOUCH #if MONOTOUCH
[MonoTouch.MonoPInvokeCallback (typeof (LuaNativeFunction))] [MonoPInvokeCallback (typeof (LuaNativeFunction))]
#endif #endif
static int AddLua (LuaState luaState) static int AddLua (LuaState luaState)
{ {
...@@ -204,7 +205,7 @@ namespace NLua ...@@ -204,7 +205,7 @@ namespace NLua
* __sub metafunction of CLR objects. * __sub metafunction of CLR objects.
*/ */
#if MONOTOUCH #if MONOTOUCH
[MonoTouch.MonoPInvokeCallback (typeof (LuaNativeFunction))] [MonoPInvokeCallback (typeof (LuaNativeFunction))]
#endif #endif
static int SubtractLua (LuaState luaState) static int SubtractLua (LuaState luaState)
{ {
...@@ -216,7 +217,7 @@ namespace NLua ...@@ -216,7 +217,7 @@ namespace NLua
* __mul metafunction of CLR objects. * __mul metafunction of CLR objects.
*/ */
#if MONOTOUCH #if MONOTOUCH
[MonoTouch.MonoPInvokeCallback (typeof (LuaNativeFunction))] [MonoPInvokeCallback (typeof (LuaNativeFunction))]
#endif #endif
static int MultiplyLua (LuaState luaState) static int MultiplyLua (LuaState luaState)
{ {
...@@ -228,7 +229,7 @@ namespace NLua ...@@ -228,7 +229,7 @@ namespace NLua
* __div metafunction of CLR objects. * __div metafunction of CLR objects.
*/ */
#if MONOTOUCH #if MONOTOUCH
[MonoTouch.MonoPInvokeCallback (typeof (LuaNativeFunction))] [MonoPInvokeCallback (typeof (LuaNativeFunction))]
#endif #endif
static int DivideLua (LuaState luaState) static int DivideLua (LuaState luaState)
{ {
...@@ -240,7 +241,7 @@ namespace NLua ...@@ -240,7 +241,7 @@ namespace NLua
* __mod metafunction of CLR objects. * __mod metafunction of CLR objects.
*/ */
#if MONOTOUCH #if MONOTOUCH
[MonoTouch.MonoPInvokeCallback (typeof (LuaNativeFunction))] [MonoPInvokeCallback (typeof (LuaNativeFunction))]
#endif #endif
static int ModLua (LuaState luaState) static int ModLua (LuaState luaState)
{ {
...@@ -252,7 +253,7 @@ namespace NLua ...@@ -252,7 +253,7 @@ namespace NLua
* __unm metafunction of CLR objects. * __unm metafunction of CLR objects.
*/ */
#if MONOTOUCH #if MONOTOUCH
[MonoTouch.MonoPInvokeCallback (typeof (LuaNativeFunction))] [MonoPInvokeCallback (typeof (LuaNativeFunction))]
#endif #endif
static int UnaryNegationLua (LuaState luaState) static int UnaryNegationLua (LuaState luaState)
{ {
...@@ -288,7 +289,7 @@ namespace NLua ...@@ -288,7 +289,7 @@ namespace NLua
* __eq metafunction of CLR objects. * __eq metafunction of CLR objects.
*/ */
#if MONOTOUCH #if MONOTOUCH
[MonoTouch.MonoPInvokeCallback (typeof (LuaNativeFunction))] [MonoPInvokeCallback (typeof (LuaNativeFunction))]
#endif #endif
static int EqualLua (LuaState luaState) static int EqualLua (LuaState luaState)
{ {
...@@ -300,7 +301,7 @@ namespace NLua ...@@ -300,7 +301,7 @@ namespace NLua
* __lt metafunction of CLR objects. * __lt metafunction of CLR objects.
*/ */
#if MONOTOUCH #if MONOTOUCH
[MonoTouch.MonoPInvokeCallback (typeof (LuaNativeFunction))] [MonoPInvokeCallback (typeof (LuaNativeFunction))]
#endif #endif
static int LessThanLua (LuaState luaState) static int LessThanLua (LuaState luaState)
{ {
...@@ -312,7 +313,7 @@ namespace NLua ...@@ -312,7 +313,7 @@ namespace NLua
* __le metafunction of CLR objects. * __le metafunction of CLR objects.
*/ */
#if MONOTOUCH #if MONOTOUCH
[MonoTouch.MonoPInvokeCallback (typeof (LuaNativeFunction))] [MonoPInvokeCallback (typeof (LuaNativeFunction))]
#endif #endif
static int LessThanOrEqualLua (LuaState luaState) static int LessThanOrEqualLua (LuaState luaState)
{ {
...@@ -365,7 +366,7 @@ namespace NLua ...@@ -365,7 +366,7 @@ namespace NLua
* If the member does not exist returns nil. * If the member does not exist returns nil.
*/ */
#if MONOTOUCH #if MONOTOUCH
[MonoTouch.MonoPInvokeCallback (typeof (LuaNativeFunction))] [MonoPInvokeCallback (typeof (LuaNativeFunction))]
#endif #endif
private static int GetMethod (LuaState luaState) private static int GetMethod (LuaState luaState)
{ {
...@@ -474,7 +475,7 @@ namespace NLua ...@@ -474,7 +475,7 @@ namespace NLua
* Adds a prefix to the method name to call the base version of the method. * Adds a prefix to the method name to call the base version of the method.
*/ */
#if MONOTOUCH #if MONOTOUCH
[MonoTouch.MonoPInvokeCallback (typeof (LuaNativeFunction))] [MonoPInvokeCallback (typeof (LuaNativeFunction))]
#endif #endif
private static int GetBaseMethod (LuaState luaState) private static int GetBaseMethod (LuaState luaState)
{ {
...@@ -764,7 +765,7 @@ namespace NLua ...@@ -764,7 +765,7 @@ namespace NLua
* and error if the assignment is invalid. * and error if the assignment is invalid.
*/ */
#if MONOTOUCH #if MONOTOUCH
[MonoTouch.MonoPInvokeCallback (typeof (LuaNativeFunction))] [MonoPInvokeCallback (typeof (LuaNativeFunction))]
#endif #endif
private static int SetFieldOrProperty (LuaState luaState) private static int SetFieldOrProperty (LuaState luaState)
{ {
...@@ -946,7 +947,7 @@ namespace NLua ...@@ -946,7 +947,7 @@ namespace NLua
* __index metafunction of type references, works on static members. * __index metafunction of type references, works on static members.
*/ */
#if MONOTOUCH #if MONOTOUCH
[MonoTouch.MonoPInvokeCallback (typeof (LuaNativeFunction))] [MonoPInvokeCallback (typeof (LuaNativeFunction))]
#endif #endif
private static int GetClassMethod (LuaState luaState) private static int GetClassMethod (LuaState luaState)
{ {
...@@ -987,7 +988,7 @@ namespace NLua ...@@ -987,7 +988,7 @@ namespace NLua
* __newindex function of type references, works on static members. * __newindex function of type references, works on static members.
*/ */
#if MONOTOUCH #if MONOTOUCH
[MonoTouch.MonoPInvokeCallback (typeof (LuaNativeFunction))] [MonoPInvokeCallback (typeof (LuaNativeFunction))]
#endif #endif
private static int SetClassFieldOrProperty (LuaState luaState) private static int SetClassFieldOrProperty (LuaState luaState)
{ {
...@@ -1014,7 +1015,7 @@ namespace NLua ...@@ -1014,7 +1015,7 @@ namespace NLua
* __call metafunction of Delegates. * __call metafunction of Delegates.
*/ */
#if MONOTOUCH #if MONOTOUCH
[MonoTouch.MonoPInvokeCallback (typeof (LuaNativeFunction))] [MonoPInvokeCallback (typeof (LuaNativeFunction))]
#endif #endif
static int CallDelegate (LuaState luaState) static int CallDelegate (LuaState luaState)
{ {
...@@ -1068,7 +1069,7 @@ namespace NLua ...@@ -1068,7 +1069,7 @@ namespace NLua
* generates an exception. * generates an exception.
*/ */
#if MONOTOUCH #if MONOTOUCH
[MonoTouch.MonoPInvokeCallback (typeof (LuaNativeFunction))] [MonoPInvokeCallback (typeof (LuaNativeFunction))]
#endif #endif
private static int CallConstructor (LuaState luaState) private static int CallConstructor (LuaState luaState)
{ {
......
...@@ -3,14 +3,14 @@ ...@@ -3,14 +3,14 @@
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>10.0.0</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{7064B157-DD57-4828-94C5-CA149B25CB40}</ProjectGuid> <ProjectGuid>{7064B157-DD57-4828-94C5-CA149B25CB40}</ProjectGuid>
<ProjectTypeGuids>{6BC8ED88-2882-458C-8E55-DFD12B67127B};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> <ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<RootNamespace>NLua.iOS</RootNamespace> <RootNamespace>NLua.iOS</RootNamespace>
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix> <IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
<AssemblyName>NLua.iOS</AssemblyName> <AssemblyName>NLua.iOS</AssemblyName>
<TargetFrameworkIdentifier>Xamarin.iOS</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v1.0</TargetFrameworkVersion>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>True</DebugSymbols> <DebugSymbols>True</DebugSymbols>
...@@ -36,9 +36,8 @@ ...@@ -36,9 +36,8 @@
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
<Reference Include="monotouch" /> <Reference Include="Xamarin.iOS" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.MonoTouch.CSharp.targets" />
<ItemGroup> <ItemGroup>
<Folder Include="GenerateEventAssembly\ios\" /> <Folder Include="GenerateEventAssembly\ios\" />
</ItemGroup> </ItemGroup>
...@@ -92,4 +91,5 @@ ...@@ -92,4 +91,5 @@
<Name>KeraLua.iOS</Name> <Name>KeraLua.iOS</Name>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
</Project> </Project>
\ No newline at end of file
...@@ -32,6 +32,7 @@ using System.Collections.Generic; ...@@ -32,6 +32,7 @@ using System.Collections.Generic;
using NLua.Method; using NLua.Method;
using NLua.Exceptions; using NLua.Exceptions;
using NLua.Extensions; using NLua.Extensions;
using ObjCRuntime;
namespace NLua namespace NLua
{ {
...@@ -259,7 +260,7 @@ namespace NLua ...@@ -259,7 +260,7 @@ namespace NLua
* if the assembly is not found. * if the assembly is not found.
*/ */
#if MONOTOUCH #if MONOTOUCH
[MonoTouch.MonoPInvokeCallback (typeof (LuaNativeFunction))] [MonoPInvokeCallback (typeof (LuaNativeFunction))]
#endif #endif
private static int LoadAssembly (LuaState luaState) private static int LoadAssembly (LuaState luaState)
{ {
...@@ -346,7 +347,7 @@ namespace NLua ...@@ -346,7 +347,7 @@ namespace NLua
* type is not found. * type is not found.
*/ */
#if MONOTOUCH #if MONOTOUCH
[MonoTouch.MonoPInvokeCallback (typeof (LuaNativeFunction))] [MonoPInvokeCallback (typeof (LuaNativeFunction))]
#endif #endif
private static int ImportType (LuaState luaState) private static int ImportType (LuaState luaState)
{ {
...@@ -373,7 +374,7 @@ namespace NLua ...@@ -373,7 +374,7 @@ namespace NLua
* type passed as second argument in the stack. * type passed as second argument in the stack.
*/ */
#if MONOTOUCH #if MONOTOUCH
[MonoTouch.MonoPInvokeCallback (typeof (LuaNativeFunction))] [MonoPInvokeCallback (typeof (LuaNativeFunction))]
#endif #endif
private static int RegisterTable (LuaState luaState) private static int RegisterTable (LuaState luaState)
{ {
...@@ -424,7 +425,7 @@ namespace NLua ...@@ -424,7 +425,7 @@ namespace NLua
* base field, freeing the created object for garbage-collection * base field, freeing the created object for garbage-collection
*/ */
#if MONOTOUCH #if MONOTOUCH
[MonoTouch.MonoPInvokeCallback (typeof (LuaNativeFunction))] [MonoPInvokeCallback (typeof (LuaNativeFunction))]
#endif #endif
private static int UnregisterTable (LuaState luaState) private static int UnregisterTable (LuaState luaState)
{ {
...@@ -468,7 +469,7 @@ namespace NLua ...@@ -468,7 +469,7 @@ namespace NLua
* if no matching method is not found. * if no matching method is not found.
*/ */
#if MONOTOUCH #if MONOTOUCH
[MonoTouch.MonoPInvokeCallback (typeof (LuaNativeFunction))] [MonoPInvokeCallback (typeof (LuaNativeFunction))]
#endif #endif
private static int GetMethodSignature (LuaState luaState) private static int GetMethodSignature (LuaState luaState)
{ {
...@@ -520,7 +521,7 @@ namespace NLua ...@@ -520,7 +521,7 @@ namespace NLua
* if no matching constructor is found. * if no matching constructor is found.
*/ */
#if MONOTOUCH #if MONOTOUCH
[MonoTouch.MonoPInvokeCallback (typeof (LuaNativeFunction))] [MonoPInvokeCallback (typeof (LuaNativeFunction))]
#endif #endif
private static int GetConstructorSignature (LuaState luaState) private static int GetConstructorSignature (LuaState luaState)
{ {
...@@ -998,7 +999,7 @@ namespace NLua ...@@ -998,7 +999,7 @@ namespace NLua
} }
#if MONOTOUCH #if MONOTOUCH
[MonoTouch.MonoPInvokeCallback (typeof (LuaNativeFunction))] [MonoPInvokeCallback (typeof (LuaNativeFunction))]
#endif #endif
private static int CType (LuaState luaState) private static int CType (LuaState luaState)
{ {
...@@ -1017,7 +1018,7 @@ namespace NLua ...@@ -1017,7 +1018,7 @@ namespace NLua
} }
#if MONOTOUCH #if MONOTOUCH
[MonoTouch.MonoPInvokeCallback (typeof (LuaNativeFunction))] [MonoPInvokeCallback (typeof (LuaNativeFunction))]
#endif #endif
private static int EnumFromInt (LuaState luaState) private static int EnumFromInt (LuaState luaState)
{ {
......
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012 # Visual Studio 2012
VisualStudioVersion = 12.0.30723.0 VisualStudioVersion = 12.0.30723.0
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{0E28CF45-4DFA-46FE-95BB-E90648DFE6F5}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{0E28CF45-4DFA-46FE-95BB-E90648DFE6F5}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleTest", "ConsoleTest\ConsoleTest.csproj", "{A42D438C-34B3-4D3D-8165-8D3779FE16A7}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleTest", "ConsoleTest\ConsoleTest.csproj", "{A42D438C-34B3-4D3D-8165-8D3779FE16A7}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NLuaTest", "NLuaTest\NLuaTest.csproj", "{D5FCADFA-5047-40C2-B392-256875862920}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NLuaTest", "NLuaTest\NLuaTest.csproj", "{D5FCADFA-5047-40C2-B392-256875862920}"
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Applications", "Applications", "{B13128D8-A4F3-4C53-A4C6-F2EA34F527BD}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Applications", "Applications", "{B13128D8-A4F3-4C53-A4C6-F2EA34F527BD}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NLua", "Applications\LuaRunner\NLua.csproj", "{3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NLua", "Applications\LuaRunner\NLua.csproj", "{3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}"
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "Core", "{B8664957-CB71-4F11-A4DB-59E7514BC5F3}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "Core", "{B8664957-CB71-4F11-A4DB-59E7514BC5F3}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KopiLua.Net45", "Core\KopiLua\KopiLua\KopiLua.Net45.csproj", "{E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KopiLua.Net45", "Core\KopiLua\KopiLua\KopiLua.Net45.csproj", "{E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NLua.Net45", "Core\NLua\NLua.Net45.csproj", "{F55CABBB-4108-4A39-94E1-581FD46DC021}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NLua.Net45", "Core\NLua\NLua.Net45.csproj", "{F55CABBB-4108-4A39-94E1-581FD46DC021}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KeraLua.Net45", "Core\KeraLua\src\KeraLua.Net45.csproj", "{47153754-10F5-44D8-B578-F5A32B69061A}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KeraLua.Net45", "Core\KeraLua\src\KeraLua.Net45.csproj", "{47153754-10F5-44D8-B578-F5A32B69061A}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64 Debug|x64 = Debug|x64
DebugKopiLua|Any CPU = DebugKopiLua|Any CPU DebugKopiLua|Any CPU = DebugKopiLua|Any CPU
DebugKopiLua|x64 = DebugKopiLua|x64 DebugKopiLua|x64 = DebugKopiLua|x64
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64 Release|x64 = Release|x64
ReleaseKopiLua|Any CPU = ReleaseKopiLua|Any CPU ReleaseKopiLua|Any CPU = ReleaseKopiLua|Any CPU
ReleaseKopiLua|x64 = ReleaseKopiLua|x64 ReleaseKopiLua|x64 = ReleaseKopiLua|x64
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}.Debug|Any CPU.Build.0 = Debug|Any CPU {3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}.Debug|x64.ActiveCfg = Debug|x64 {3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}.Debug|x64.ActiveCfg = Debug|x64
{3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}.Debug|x64.Build.0 = Debug|x64 {3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}.Debug|x64.Build.0 = Debug|x64
{3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}.DebugKopiLua|Any CPU.ActiveCfg = DebugKopiLua|Any CPU {3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}.DebugKopiLua|Any CPU.ActiveCfg = DebugKopiLua|Any CPU
{3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}.DebugKopiLua|Any CPU.Build.0 = DebugKopiLua|Any CPU {3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}.DebugKopiLua|Any CPU.Build.0 = DebugKopiLua|Any CPU
{3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}.DebugKopiLua|x64.ActiveCfg = DebugKopiLua|x64 {3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}.DebugKopiLua|x64.ActiveCfg = DebugKopiLua|x64
{3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}.DebugKopiLua|x64.Build.0 = DebugKopiLua|x64 {3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}.DebugKopiLua|x64.Build.0 = DebugKopiLua|x64
{3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}.Release|Any CPU.ActiveCfg = Release|Any CPU {3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}.Release|Any CPU.Build.0 = Release|Any CPU {3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}.Release|Any CPU.Build.0 = Release|Any CPU
{3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}.Release|x64.ActiveCfg = Release|x64 {3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}.Release|x64.ActiveCfg = Release|x64
{3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}.Release|x64.Build.0 = Release|x64 {3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}.Release|x64.Build.0 = Release|x64
{3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}.ReleaseKopiLua|Any CPU.ActiveCfg = ReleaseKopiLua|Any CPU {3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}.ReleaseKopiLua|Any CPU.ActiveCfg = ReleaseKopiLua|Any CPU
{3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}.ReleaseKopiLua|Any CPU.Build.0 = ReleaseKopiLua|Any CPU {3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}.ReleaseKopiLua|Any CPU.Build.0 = ReleaseKopiLua|Any CPU
{3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}.ReleaseKopiLua|x64.ActiveCfg = ReleaseKopiLua|x64 {3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}.ReleaseKopiLua|x64.ActiveCfg = ReleaseKopiLua|x64
{3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}.ReleaseKopiLua|x64.Build.0 = ReleaseKopiLua|x64 {3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}.ReleaseKopiLua|x64.Build.0 = ReleaseKopiLua|x64
{47153754-10F5-44D8-B578-F5A32B69061A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {47153754-10F5-44D8-B578-F5A32B69061A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{47153754-10F5-44D8-B578-F5A32B69061A}.Debug|Any CPU.Build.0 = Debug|Any CPU {47153754-10F5-44D8-B578-F5A32B69061A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{47153754-10F5-44D8-B578-F5A32B69061A}.Debug|x64.ActiveCfg = Debug|Any CPU {47153754-10F5-44D8-B578-F5A32B69061A}.Debug|x64.ActiveCfg = Debug|Any CPU
{47153754-10F5-44D8-B578-F5A32B69061A}.Debug|x64.Build.0 = Debug|Any CPU {47153754-10F5-44D8-B578-F5A32B69061A}.Debug|x64.Build.0 = Debug|Any CPU
{47153754-10F5-44D8-B578-F5A32B69061A}.DebugKopiLua|Any CPU.ActiveCfg = DebugKopiLua|Any CPU {47153754-10F5-44D8-B578-F5A32B69061A}.DebugKopiLua|Any CPU.ActiveCfg = DebugKopiLua|Any CPU
{47153754-10F5-44D8-B578-F5A32B69061A}.DebugKopiLua|Any CPU.Build.0 = DebugKopiLua|Any CPU {47153754-10F5-44D8-B578-F5A32B69061A}.DebugKopiLua|Any CPU.Build.0 = DebugKopiLua|Any CPU
{47153754-10F5-44D8-B578-F5A32B69061A}.DebugKopiLua|x64.ActiveCfg = DebugKopiLua|Any CPU {47153754-10F5-44D8-B578-F5A32B69061A}.DebugKopiLua|x64.ActiveCfg = DebugKopiLua|Any CPU
{47153754-10F5-44D8-B578-F5A32B69061A}.DebugKopiLua|x64.Build.0 = DebugKopiLua|Any CPU {47153754-10F5-44D8-B578-F5A32B69061A}.DebugKopiLua|x64.Build.0 = DebugKopiLua|Any CPU
{47153754-10F5-44D8-B578-F5A32B69061A}.Release|Any CPU.ActiveCfg = Release|Any CPU {47153754-10F5-44D8-B578-F5A32B69061A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{47153754-10F5-44D8-B578-F5A32B69061A}.Release|Any CPU.Build.0 = Release|Any CPU {47153754-10F5-44D8-B578-F5A32B69061A}.Release|Any CPU.Build.0 = Release|Any CPU
{47153754-10F5-44D8-B578-F5A32B69061A}.Release|x64.ActiveCfg = Release|Any CPU {47153754-10F5-44D8-B578-F5A32B69061A}.Release|x64.ActiveCfg = Release|Any CPU
{47153754-10F5-44D8-B578-F5A32B69061A}.Release|x64.Build.0 = Release|Any CPU {47153754-10F5-44D8-B578-F5A32B69061A}.Release|x64.Build.0 = Release|Any CPU
{47153754-10F5-44D8-B578-F5A32B69061A}.ReleaseKopiLua|Any CPU.ActiveCfg = ReleaseKopiLua|Any CPU {47153754-10F5-44D8-B578-F5A32B69061A}.ReleaseKopiLua|Any CPU.ActiveCfg = ReleaseKopiLua|Any CPU
{47153754-10F5-44D8-B578-F5A32B69061A}.ReleaseKopiLua|Any CPU.Build.0 = ReleaseKopiLua|Any CPU {47153754-10F5-44D8-B578-F5A32B69061A}.ReleaseKopiLua|Any CPU.Build.0 = ReleaseKopiLua|Any CPU
{47153754-10F5-44D8-B578-F5A32B69061A}.ReleaseKopiLua|x64.ActiveCfg = ReleaseKopiLua|Any CPU {47153754-10F5-44D8-B578-F5A32B69061A}.ReleaseKopiLua|x64.ActiveCfg = ReleaseKopiLua|Any CPU
{47153754-10F5-44D8-B578-F5A32B69061A}.ReleaseKopiLua|x64.Build.0 = ReleaseKopiLua|Any CPU {47153754-10F5-44D8-B578-F5A32B69061A}.ReleaseKopiLua|x64.Build.0 = ReleaseKopiLua|Any CPU
{A42D438C-34B3-4D3D-8165-8D3779FE16A7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A42D438C-34B3-4D3D-8165-8D3779FE16A7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A42D438C-34B3-4D3D-8165-8D3779FE16A7}.Debug|Any CPU.Build.0 = Debug|Any CPU {A42D438C-34B3-4D3D-8165-8D3779FE16A7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A42D438C-34B3-4D3D-8165-8D3779FE16A7}.Debug|x64.ActiveCfg = Debug|Any CPU {A42D438C-34B3-4D3D-8165-8D3779FE16A7}.Debug|x64.ActiveCfg = Debug|Any CPU
{A42D438C-34B3-4D3D-8165-8D3779FE16A7}.Debug|x64.Build.0 = Debug|Any CPU {A42D438C-34B3-4D3D-8165-8D3779FE16A7}.Debug|x64.Build.0 = Debug|Any CPU
{A42D438C-34B3-4D3D-8165-8D3779FE16A7}.DebugKopiLua|Any CPU.ActiveCfg = DebugKopiLua|Any CPU {A42D438C-34B3-4D3D-8165-8D3779FE16A7}.DebugKopiLua|Any CPU.ActiveCfg = DebugKopiLua|Any CPU
{A42D438C-34B3-4D3D-8165-8D3779FE16A7}.DebugKopiLua|Any CPU.Build.0 = DebugKopiLua|Any CPU {A42D438C-34B3-4D3D-8165-8D3779FE16A7}.DebugKopiLua|Any CPU.Build.0 = DebugKopiLua|Any CPU
{A42D438C-34B3-4D3D-8165-8D3779FE16A7}.DebugKopiLua|x64.ActiveCfg = DebugKopiLua|Any CPU {A42D438C-34B3-4D3D-8165-8D3779FE16A7}.DebugKopiLua|x64.ActiveCfg = DebugKopiLua|Any CPU
{A42D438C-34B3-4D3D-8165-8D3779FE16A7}.DebugKopiLua|x64.Build.0 = DebugKopiLua|Any CPU {A42D438C-34B3-4D3D-8165-8D3779FE16A7}.DebugKopiLua|x64.Build.0 = DebugKopiLua|Any CPU
{A42D438C-34B3-4D3D-8165-8D3779FE16A7}.Release|Any CPU.ActiveCfg = Release|Any CPU {A42D438C-34B3-4D3D-8165-8D3779FE16A7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A42D438C-34B3-4D3D-8165-8D3779FE16A7}.Release|Any CPU.Build.0 = Release|Any CPU {A42D438C-34B3-4D3D-8165-8D3779FE16A7}.Release|Any CPU.Build.0 = Release|Any CPU
{A42D438C-34B3-4D3D-8165-8D3779FE16A7}.Release|x64.ActiveCfg = Release|Any CPU {A42D438C-34B3-4D3D-8165-8D3779FE16A7}.Release|x64.ActiveCfg = Release|Any CPU
{A42D438C-34B3-4D3D-8165-8D3779FE16A7}.Release|x64.Build.0 = Release|Any CPU {A42D438C-34B3-4D3D-8165-8D3779FE16A7}.Release|x64.Build.0 = Release|Any CPU
{A42D438C-34B3-4D3D-8165-8D3779FE16A7}.ReleaseKopiLua|Any CPU.ActiveCfg = ReleaseKopiLua|Any CPU {A42D438C-34B3-4D3D-8165-8D3779FE16A7}.ReleaseKopiLua|Any CPU.ActiveCfg = ReleaseKopiLua|Any CPU
{A42D438C-34B3-4D3D-8165-8D3779FE16A7}.ReleaseKopiLua|Any CPU.Build.0 = ReleaseKopiLua|Any CPU {A42D438C-34B3-4D3D-8165-8D3779FE16A7}.ReleaseKopiLua|Any CPU.Build.0 = ReleaseKopiLua|Any CPU
{A42D438C-34B3-4D3D-8165-8D3779FE16A7}.ReleaseKopiLua|x64.ActiveCfg = ReleaseKopiLua|Any CPU {A42D438C-34B3-4D3D-8165-8D3779FE16A7}.ReleaseKopiLua|x64.ActiveCfg = ReleaseKopiLua|Any CPU
{A42D438C-34B3-4D3D-8165-8D3779FE16A7}.ReleaseKopiLua|x64.Build.0 = ReleaseKopiLua|Any CPU {A42D438C-34B3-4D3D-8165-8D3779FE16A7}.ReleaseKopiLua|x64.Build.0 = ReleaseKopiLua|Any CPU
{D5FCADFA-5047-40C2-B392-256875862920}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D5FCADFA-5047-40C2-B392-256875862920}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D5FCADFA-5047-40C2-B392-256875862920}.Debug|Any CPU.Build.0 = Debug|Any CPU {D5FCADFA-5047-40C2-B392-256875862920}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D5FCADFA-5047-40C2-B392-256875862920}.Debug|x64.ActiveCfg = Debug|Any CPU {D5FCADFA-5047-40C2-B392-256875862920}.Debug|x64.ActiveCfg = Debug|Any CPU
{D5FCADFA-5047-40C2-B392-256875862920}.DebugKopiLua|Any CPU.ActiveCfg = DebugKopiLua|Any CPU {D5FCADFA-5047-40C2-B392-256875862920}.DebugKopiLua|Any CPU.ActiveCfg = DebugKopiLua|Any CPU
{D5FCADFA-5047-40C2-B392-256875862920}.DebugKopiLua|Any CPU.Build.0 = DebugKopiLua|Any CPU {D5FCADFA-5047-40C2-B392-256875862920}.DebugKopiLua|Any CPU.Build.0 = DebugKopiLua|Any CPU
{D5FCADFA-5047-40C2-B392-256875862920}.DebugKopiLua|x64.ActiveCfg = DebugKopiLua|Any CPU {D5FCADFA-5047-40C2-B392-256875862920}.DebugKopiLua|x64.ActiveCfg = DebugKopiLua|Any CPU
{D5FCADFA-5047-40C2-B392-256875862920}.Release|Any CPU.ActiveCfg = Release|Any CPU {D5FCADFA-5047-40C2-B392-256875862920}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D5FCADFA-5047-40C2-B392-256875862920}.Release|Any CPU.Build.0 = Release|Any CPU {D5FCADFA-5047-40C2-B392-256875862920}.Release|Any CPU.Build.0 = Release|Any CPU
{D5FCADFA-5047-40C2-B392-256875862920}.Release|x64.ActiveCfg = Release|Any CPU {D5FCADFA-5047-40C2-B392-256875862920}.Release|x64.ActiveCfg = Release|Any CPU
{D5FCADFA-5047-40C2-B392-256875862920}.ReleaseKopiLua|Any CPU.ActiveCfg = ReleaseKopiLua|Any CPU {D5FCADFA-5047-40C2-B392-256875862920}.ReleaseKopiLua|Any CPU.ActiveCfg = ReleaseKopiLua|Any CPU
{D5FCADFA-5047-40C2-B392-256875862920}.ReleaseKopiLua|Any CPU.Build.0 = ReleaseKopiLua|Any CPU {D5FCADFA-5047-40C2-B392-256875862920}.ReleaseKopiLua|Any CPU.Build.0 = ReleaseKopiLua|Any CPU
{D5FCADFA-5047-40C2-B392-256875862920}.ReleaseKopiLua|x64.ActiveCfg = ReleaseKopiLua|Any CPU {D5FCADFA-5047-40C2-B392-256875862920}.ReleaseKopiLua|x64.ActiveCfg = ReleaseKopiLua|Any CPU
{E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}.Debug|Any CPU.Build.0 = Debug|Any CPU {E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}.Debug|x64.ActiveCfg = Debug|Any CPU {E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}.Debug|x64.ActiveCfg = Debug|Any CPU
{E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}.Debug|x64.Build.0 = Debug|Any CPU {E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}.Debug|x64.Build.0 = Debug|Any CPU
{E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}.DebugKopiLua|Any CPU.ActiveCfg = DebugKopiLua|Any CPU {E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}.DebugKopiLua|Any CPU.ActiveCfg = DebugKopiLua|Any CPU
{E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}.DebugKopiLua|Any CPU.Build.0 = DebugKopiLua|Any CPU {E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}.DebugKopiLua|Any CPU.Build.0 = DebugKopiLua|Any CPU
{E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}.DebugKopiLua|x64.ActiveCfg = DebugKopiLua|Any CPU {E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}.DebugKopiLua|x64.ActiveCfg = DebugKopiLua|Any CPU
{E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}.DebugKopiLua|x64.Build.0 = DebugKopiLua|Any CPU {E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}.DebugKopiLua|x64.Build.0 = DebugKopiLua|Any CPU
{E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}.Release|Any CPU.ActiveCfg = Release|Any CPU {E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}.Release|Any CPU.Build.0 = Release|Any CPU {E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}.Release|Any CPU.Build.0 = Release|Any CPU
{E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}.Release|x64.ActiveCfg = Release|Any CPU {E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}.Release|x64.ActiveCfg = Release|Any CPU
{E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}.Release|x64.Build.0 = Release|Any CPU {E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}.Release|x64.Build.0 = Release|Any CPU
{E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}.ReleaseKopiLua|Any CPU.ActiveCfg = ReleaseKopiLua|Any CPU {E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}.ReleaseKopiLua|Any CPU.ActiveCfg = ReleaseKopiLua|Any CPU
{E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}.ReleaseKopiLua|Any CPU.Build.0 = ReleaseKopiLua|Any CPU {E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}.ReleaseKopiLua|Any CPU.Build.0 = ReleaseKopiLua|Any CPU
{E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}.ReleaseKopiLua|x64.ActiveCfg = ReleaseKopiLua|Any CPU {E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}.ReleaseKopiLua|x64.ActiveCfg = ReleaseKopiLua|Any CPU
{E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}.ReleaseKopiLua|x64.Build.0 = ReleaseKopiLua|Any CPU {E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}.ReleaseKopiLua|x64.Build.0 = ReleaseKopiLua|Any CPU
{F55CABBB-4108-4A39-94E1-581FD46DC021}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F55CABBB-4108-4A39-94E1-581FD46DC021}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F55CABBB-4108-4A39-94E1-581FD46DC021}.Debug|Any CPU.Build.0 = Debug|Any CPU {F55CABBB-4108-4A39-94E1-581FD46DC021}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F55CABBB-4108-4A39-94E1-581FD46DC021}.Debug|x64.ActiveCfg = Debug|Any CPU {F55CABBB-4108-4A39-94E1-581FD46DC021}.Debug|x64.ActiveCfg = Debug|Any CPU
{F55CABBB-4108-4A39-94E1-581FD46DC021}.Debug|x64.Build.0 = Debug|Any CPU {F55CABBB-4108-4A39-94E1-581FD46DC021}.Debug|x64.Build.0 = Debug|Any CPU
{F55CABBB-4108-4A39-94E1-581FD46DC021}.DebugKopiLua|Any CPU.ActiveCfg = DebugKopiLua|Any CPU {F55CABBB-4108-4A39-94E1-581FD46DC021}.DebugKopiLua|Any CPU.ActiveCfg = DebugKopiLua|Any CPU
{F55CABBB-4108-4A39-94E1-581FD46DC021}.DebugKopiLua|Any CPU.Build.0 = DebugKopiLua|Any CPU {F55CABBB-4108-4A39-94E1-581FD46DC021}.DebugKopiLua|Any CPU.Build.0 = DebugKopiLua|Any CPU
{F55CABBB-4108-4A39-94E1-581FD46DC021}.DebugKopiLua|x64.ActiveCfg = DebugKopiLua|Any CPU {F55CABBB-4108-4A39-94E1-581FD46DC021}.DebugKopiLua|x64.ActiveCfg = DebugKopiLua|Any CPU
{F55CABBB-4108-4A39-94E1-581FD46DC021}.DebugKopiLua|x64.Build.0 = DebugKopiLua|Any CPU {F55CABBB-4108-4A39-94E1-581FD46DC021}.DebugKopiLua|x64.Build.0 = DebugKopiLua|Any CPU
{F55CABBB-4108-4A39-94E1-581FD46DC021}.Release|Any CPU.ActiveCfg = Release|Any CPU {F55CABBB-4108-4A39-94E1-581FD46DC021}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F55CABBB-4108-4A39-94E1-581FD46DC021}.Release|Any CPU.Build.0 = Release|Any CPU {F55CABBB-4108-4A39-94E1-581FD46DC021}.Release|Any CPU.Build.0 = Release|Any CPU
{F55CABBB-4108-4A39-94E1-581FD46DC021}.Release|x64.ActiveCfg = Release|Any CPU {F55CABBB-4108-4A39-94E1-581FD46DC021}.Release|x64.ActiveCfg = Release|Any CPU
{F55CABBB-4108-4A39-94E1-581FD46DC021}.Release|x64.Build.0 = Release|Any CPU {F55CABBB-4108-4A39-94E1-581FD46DC021}.Release|x64.Build.0 = Release|Any CPU
{F55CABBB-4108-4A39-94E1-581FD46DC021}.ReleaseKopiLua|Any CPU.ActiveCfg = ReleaseKopiLua|Any CPU {F55CABBB-4108-4A39-94E1-581FD46DC021}.ReleaseKopiLua|Any CPU.ActiveCfg = ReleaseKopiLua|Any CPU
{F55CABBB-4108-4A39-94E1-581FD46DC021}.ReleaseKopiLua|Any CPU.Build.0 = ReleaseKopiLua|Any CPU {F55CABBB-4108-4A39-94E1-581FD46DC021}.ReleaseKopiLua|Any CPU.Build.0 = ReleaseKopiLua|Any CPU
{F55CABBB-4108-4A39-94E1-581FD46DC021}.ReleaseKopiLua|x64.ActiveCfg = ReleaseKopiLua|Any CPU {F55CABBB-4108-4A39-94E1-581FD46DC021}.ReleaseKopiLua|x64.ActiveCfg = ReleaseKopiLua|Any CPU
{F55CABBB-4108-4A39-94E1-581FD46DC021}.ReleaseKopiLua|x64.Build.0 = ReleaseKopiLua|Any CPU {F55CABBB-4108-4A39-94E1-581FD46DC021}.ReleaseKopiLua|x64.Build.0 = ReleaseKopiLua|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(NestedProjects) = preSolution GlobalSection(NestedProjects) = preSolution
{A42D438C-34B3-4D3D-8165-8D3779FE16A7} = {0E28CF45-4DFA-46FE-95BB-E90648DFE6F5} {A42D438C-34B3-4D3D-8165-8D3779FE16A7} = {0E28CF45-4DFA-46FE-95BB-E90648DFE6F5}
{D5FCADFA-5047-40C2-B392-256875862920} = {0E28CF45-4DFA-46FE-95BB-E90648DFE6F5} {D5FCADFA-5047-40C2-B392-256875862920} = {0E28CF45-4DFA-46FE-95BB-E90648DFE6F5}
{3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5} = {B13128D8-A4F3-4C53-A4C6-F2EA34F527BD} {3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5} = {B13128D8-A4F3-4C53-A4C6-F2EA34F527BD}
{E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8} = {B8664957-CB71-4F11-A4DB-59E7514BC5F3} {E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8} = {B8664957-CB71-4F11-A4DB-59E7514BC5F3}
{F55CABBB-4108-4A39-94E1-581FD46DC021} = {B8664957-CB71-4F11-A4DB-59E7514BC5F3} {F55CABBB-4108-4A39-94E1-581FD46DC021} = {B8664957-CB71-4F11-A4DB-59E7514BC5F3}
{47153754-10F5-44D8-B578-F5A32B69061A} = {B8664957-CB71-4F11-A4DB-59E7514BC5F3} {47153754-10F5-44D8-B578-F5A32B69061A} = {B8664957-CB71-4F11-A4DB-59E7514BC5F3}
EndGlobalSection EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = Applications\LuaRunner\NLua.csproj StartupItem = ConsoleTest\ConsoleTest.csproj
Policies = $0 Policies = $0
$0.TextStylePolicy = $1 $0.TextStylePolicy = $1
$1.FileWidth = 120 $1.FileWidth = 120
$1.TabsToSpaces = False $1.TabsToSpaces = False
$1.inheritsSet = VisualStudio $1.inheritsSet = VisualStudio
$1.inheritsScope = text/plain $1.inheritsScope = text/plain
$0.DotNetNamingPolicy = $2 $0.DotNetNamingPolicy = $2
$2.DirectoryNamespaceAssociation = None $2.DirectoryNamespaceAssociation = None
$2.ResourceNamePolicy = FileFormatDefault $2.ResourceNamePolicy = FileFormatDefault
$0.TextStylePolicy = $3 $0.TextStylePolicy = $3
$3.FileWidth = 120 $3.FileWidth = 120
$3.TabsToSpaces = False $3.TabsToSpaces = False
$3.EolMarker = Windows $3.EolMarker = Windows
$3.inheritsSet = VisualStudio $3.inheritsSet = VisualStudio
$3.inheritsScope = text/plain $3.inheritsScope = text/plain
$3.scope = text/x-csharp $3.scope = text/x-csharp
$0.CSharpFormattingPolicy = $4 $0.CSharpFormattingPolicy = $4
$4.AfterDelegateDeclarationParameterComma = True $4.AfterDelegateDeclarationParameterComma = True
$4.inheritsSet = Mono $4.inheritsSet = Mono
$4.inheritsScope = text/x-csharp $4.inheritsScope = text/x-csharp
$4.scope = text/x-csharp $4.scope = text/x-csharp
$0.TextStylePolicy = $5 $0.TextStylePolicy = $5
$5.FileWidth = 120 $5.FileWidth = 120
$5.TabsToSpaces = False $5.TabsToSpaces = False
$5.inheritsSet = VisualStudio $5.inheritsSet = VisualStudio
$5.inheritsScope = text/plain $5.inheritsScope = text/plain
$5.scope = text/plain $5.scope = text/plain
description = NLua description = NLua
version = 1.3.1 version = 1.3.1
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal
...@@ -14,7 +14,7 @@ using NUnit.Framework; ...@@ -14,7 +14,7 @@ using NUnit.Framework;
#endif #endif
#if MONOTOUCH #if MONOTOUCH
using MonoTouch.Foundation; using Foundation;
using MonoTouch; using MonoTouch;
#endif #endif
......
...@@ -2,8 +2,8 @@ using System; ...@@ -2,8 +2,8 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using MonoTouch.Foundation; using Foundation;
using MonoTouch.UIKit; using UIKit;
namespace NLuaTestsiOS namespace NLuaTestsiOS
{ {
......
...@@ -4,11 +4,13 @@ ...@@ -4,11 +4,13 @@
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform> <Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
<ProjectGuid>{2DC0E43A-21B8-41FF-8793-60AB50350977}</ProjectGuid> <ProjectGuid>{2DC0E43A-21B8-41FF-8793-60AB50350977}</ProjectGuid>
<ProjectTypeGuids>{6BC8ED88-2882-458C-8E55-DFD12B67127B};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> <ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<RootNamespace>NLuaTest</RootNamespace> <RootNamespace>NLuaTest</RootNamespace>
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix> <IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
<AssemblyName>NLuaTest</AssemblyName> <AssemblyName>NLuaTest</AssemblyName>
<TargetFrameworkIdentifier>Xamarin.iOS</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v1.0</TargetFrameworkVersion>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
<DebugSymbols>True</DebugSymbols> <DebugSymbols>True</DebugSymbols>
...@@ -107,9 +109,9 @@ ...@@ -107,9 +109,9 @@
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="monotouch" />
<Reference Include="MonoTouch.NUnitLite" /> <Reference Include="MonoTouch.NUnitLite" />
<Reference Include="System.Numerics" /> <Reference Include="System.Numerics" />
<Reference Include="Xamarin.iOS" />
</ItemGroup> </ItemGroup>
<ItemGroup /> <ItemGroup />
<ItemGroup> <ItemGroup>
...@@ -138,7 +140,6 @@ ...@@ -138,7 +140,6 @@
<Link>LoadFileTests.cs</Link> <Link>LoadFileTests.cs</Link>
</Compile> </Compile>
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.MonoTouch.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" /> <Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\Core\NLua\NLua.iOS.csproj"> <ProjectReference Include="..\..\Core\NLua\NLua.iOS.csproj">
......
...@@ -5,7 +5,7 @@ using NLua; ...@@ -5,7 +5,7 @@ using NLua;
using NLuaTest.Mock; using NLuaTest.Mock;
#if MONOTOUCH #if MONOTOUCH
using MonoTouch.Foundation; using Foundation;
using MonoTouch; using MonoTouch;
#endif #endif
...@@ -42,7 +42,7 @@ namespace NLuaTest ...@@ -42,7 +42,7 @@ namespace NLuaTest
using (Lua lua = new Lua ()) { using (Lua lua = new Lua ()) {
lua.LoadCLRPackage (); lua.LoadCLRPackage ();
lua.DoString ("import ('monotouch', 'MonoTouch.Foundation') "); lua.DoString ("import ('Xamarin.iOS', 'Foundation') ");
lua.DoString ("testURL = NSUrl('http://nlua.org/?query=param')"); lua.DoString ("testURL = NSUrl('http://nlua.org/?query=param')");
lua.DoString ("host = testURL.Host"); lua.DoString ("host = testURL.Host");
......
...@@ -2,8 +2,8 @@ using System; ...@@ -2,8 +2,8 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using MonoTouch.Foundation; using Foundation;
using MonoTouch.UIKit; using UIKit;
using MonoTouch.NUnit.UI; using MonoTouch.NUnit.UI;
namespace NLuaTestsiOS namespace NLuaTestsiOS
......
...@@ -2,20 +2,20 @@ ...@@ -2,20 +2,20 @@
using System; using System;
using NLua; using NLua;
using NLua.Exceptions; using NLua.Exceptions;
using System.IO; using System.IO;
#if WINDOWS_PHONE #if WINDOWS_PHONE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework; using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using SetUp = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestInitializeAttribute; using SetUp = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestInitializeAttribute;
using TearDown = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestCleanupAttribute; using TearDown = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestCleanupAttribute;
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute; using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute; using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
#else #else
using NUnit.Framework; using NUnit.Framework;
#endif #endif
#if MONOTOUCH #if MONOTOUCH
using MonoTouch.Foundation; using Foundation;
#endif #endif
namespace NLuaTest namespace NLuaTest
...@@ -48,8 +48,8 @@ namespace NLuaTest ...@@ -48,8 +48,8 @@ namespace NLuaTest
[SetUp] [SetUp]
public void Setup() public void Setup()
{ {
lua = new Lua (); lua = new Lua ();
lua.RegisterFunction ("WriteLineString", typeof (Console).GetMethod ("WriteLine", new Type [] { typeof (String) })); lua.RegisterFunction ("WriteLineString", typeof (Console).GetMethod ("WriteLine", new Type [] { typeof (String) }));
lua.DoString (@" lua.DoString (@"
function print (param) function print (param)
...@@ -77,7 +77,7 @@ namespace NLuaTest ...@@ -77,7 +77,7 @@ namespace NLuaTest
TestLuaFile ("cf"); TestLuaFile ("cf");
} }
[Test] [Test]
[Ignore] [Ignore]
public void Env () public void Env ()
{ {
...@@ -108,7 +108,7 @@ namespace NLuaTest ...@@ -108,7 +108,7 @@ namespace NLuaTest
TestLuaFile ("printf"); TestLuaFile ("printf");
} }
[Test] [Test]
[Ignore] [Ignore]
public void ReadOnly () public void ReadOnly ()
{ {
......
...@@ -7,7 +7,7 @@ using System.Threading; ...@@ -7,7 +7,7 @@ using System.Threading;
using NLua; using NLua;
using NLua.Exceptions; using NLua.Exceptions;
#if MONOTOUCH #if MONOTOUCH
using MonoTouch.Foundation; using Foundation;
#endif #endif
#if WINDOWS_PHONE #if WINDOWS_PHONE
......
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