Commit ea33713d authored by Vinicius Jarina's avatar Vinicius Jarina
Browse files

Removing Gendarme Warnings.

parent 769c8950
Subproject commit a64268ad3f8513dca48d2eabd4c8c5db7fa90798
Subproject commit df2cee885786733e6397a4f8db0a05f9aa176111
Subproject commit fd01e1094246498dbe22180f3f60019540e18f76
Subproject commit 3bf5dade6bdf3f86e5d6d0157bcf7cbee63c8d24
......@@ -95,7 +95,7 @@ namespace NLua
return extractValues.ContainsKey(extractKey) ? extractValues[extractKey] : extractNetObject;
}
internal ExtractValue checkType (LuaCore.lua_State luaState, int stackPos, Type paramType)
internal ExtractValue checkType (LuaCore.LuaState luaState, int stackPos, Type paramType)
{
var luatype = LuaLib.lua_type (luaState, stackPos);
......@@ -189,7 +189,7 @@ namespace NLua
* index stackPos as the desired type if it can, or null
* otherwise.
*/
private object getAsSbyte (LuaCore.lua_State luaState, int stackPos)
private object getAsSbyte (LuaCore.LuaState luaState, int stackPos)
{
sbyte retVal = (sbyte)LuaLib.lua_tonumber (luaState, stackPos);
if (retVal == 0 && !LuaLib.lua_isnumber (luaState, stackPos))
......@@ -198,7 +198,7 @@ namespace NLua
return retVal;
}
private object getAsByte (LuaCore.lua_State luaState, int stackPos)
private object getAsByte (LuaCore.LuaState luaState, int stackPos)
{
byte retVal = (byte)LuaLib.lua_tonumber (luaState, stackPos);
if (retVal == 0 && !LuaLib.lua_isnumber (luaState, stackPos))
......@@ -207,7 +207,7 @@ namespace NLua
return retVal;
}
private object getAsShort (LuaCore.lua_State luaState, int stackPos)
private object getAsShort (LuaCore.LuaState luaState, int stackPos)
{
short retVal = (short)LuaLib.lua_tonumber (luaState, stackPos);
if (retVal == 0 && !LuaLib.lua_isnumber (luaState, stackPos))
......@@ -216,7 +216,7 @@ namespace NLua
return retVal;
}
private object getAsUshort (LuaCore.lua_State luaState, int stackPos)
private object getAsUshort (LuaCore.LuaState luaState, int stackPos)
{
ushort retVal = (ushort)LuaLib.lua_tonumber (luaState, stackPos);
if (retVal == 0 && !LuaLib.lua_isnumber (luaState, stackPos))
......@@ -225,7 +225,7 @@ namespace NLua
return retVal;
}
private object getAsInt (LuaCore.lua_State luaState, int stackPos)
private object getAsInt (LuaCore.LuaState luaState, int stackPos)
{
int retVal = (int)LuaLib.lua_tonumber (luaState, stackPos);
if (retVal == 0 && !LuaLib.lua_isnumber (luaState, stackPos))
......@@ -234,7 +234,7 @@ namespace NLua
return retVal;
}
private object getAsUint (LuaCore.lua_State luaState, int stackPos)
private object getAsUint (LuaCore.LuaState luaState, int stackPos)
{
uint retVal = (uint)LuaLib.lua_tonumber (luaState, stackPos);
if (retVal == 0 && !LuaLib.lua_isnumber (luaState, stackPos))
......@@ -243,7 +243,7 @@ namespace NLua
return retVal;
}
private object getAsLong (LuaCore.lua_State luaState, int stackPos)
private object getAsLong (LuaCore.LuaState luaState, int stackPos)
{
long retVal = (long)LuaLib.lua_tonumber (luaState, stackPos);
if (retVal == 0 && !LuaLib.lua_isnumber (luaState, stackPos))
......@@ -252,7 +252,7 @@ namespace NLua
return retVal;
}
private object getAsUlong (LuaCore.lua_State luaState, int stackPos)
private object getAsUlong (LuaCore.LuaState luaState, int stackPos)
{
ulong retVal = (ulong)LuaLib.lua_tonumber (luaState, stackPos);
if (retVal == 0 && !LuaLib.lua_isnumber (luaState, stackPos))
......@@ -261,7 +261,7 @@ namespace NLua
return retVal;
}
private object getAsDouble (LuaCore.lua_State luaState, int stackPos)
private object getAsDouble (LuaCore.LuaState luaState, int stackPos)
{
double retVal = LuaLib.lua_tonumber (luaState, stackPos);
if (retVal == 0 && !LuaLib.lua_isnumber (luaState, stackPos))
......@@ -270,7 +270,7 @@ namespace NLua
return retVal;
}
private object getAsChar (LuaCore.lua_State luaState, int stackPos)
private object getAsChar (LuaCore.LuaState luaState, int stackPos)
{
char retVal = (char)LuaLib.lua_tonumber (luaState, stackPos);
if (retVal == 0 && !LuaLib.lua_isnumber (luaState, stackPos))
......@@ -279,7 +279,7 @@ namespace NLua
return retVal;
}
private object getAsFloat (LuaCore.lua_State luaState, int stackPos)
private object getAsFloat (LuaCore.LuaState luaState, int stackPos)
{
float retVal = (float)LuaLib.lua_tonumber (luaState, stackPos);
if (retVal == 0 && !LuaLib.lua_isnumber (luaState, stackPos))
......@@ -288,7 +288,7 @@ namespace NLua
return retVal;
}
private object getAsDecimal (LuaCore.lua_State luaState, int stackPos)
private object getAsDecimal (LuaCore.LuaState luaState, int stackPos)
{
decimal retVal = (decimal)LuaLib.lua_tonumber (luaState, stackPos);
if (retVal == 0 && !LuaLib.lua_isnumber (luaState, stackPos))
......@@ -297,12 +297,12 @@ namespace NLua
return retVal;
}
private object getAsBoolean (LuaCore.lua_State luaState, int stackPos)
private object getAsBoolean (LuaCore.LuaState luaState, int stackPos)
{
return LuaLib.lua_toboolean (luaState, stackPos);
}
private object getAsString (LuaCore.lua_State luaState, int stackPos)
private object getAsString (LuaCore.LuaState luaState, int stackPos)
{
string retVal = LuaLib.lua_tostring (luaState, stackPos).ToString ();
if (retVal == string.Empty && !LuaLib.lua_isstring (luaState, stackPos))
......@@ -311,22 +311,22 @@ namespace NLua
return retVal;
}
private object getAsTable (LuaCore.lua_State luaState, int stackPos)
private object getAsTable (LuaCore.LuaState luaState, int stackPos)
{
return translator.getTable (luaState, stackPos);
}
private object getAsFunction (LuaCore.lua_State luaState, int stackPos)
private object getAsFunction (LuaCore.LuaState luaState, int stackPos)
{
return translator.getFunction (luaState, stackPos);
}
private object getAsUserdata (LuaCore.lua_State luaState, int stackPos)
private object getAsUserdata (LuaCore.LuaState luaState, int stackPos)
{
return translator.getUserData (luaState, stackPos);
}
public object getAsObject (LuaCore.lua_State luaState, int stackPos)
public object getAsObject (LuaCore.LuaState luaState, int stackPos)
{
if (LuaLib.lua_type (luaState, stackPos) == LuaTypes.Table) {
if (LuaLib.luaL_getmetafield (luaState, stackPos, "__index")) {
......@@ -342,7 +342,7 @@ namespace NLua
return obj;
}
public object getAsNetObject (LuaCore.lua_State luaState, int stackPos)
public object getAsNetObject (LuaCore.LuaState luaState, int stackPos)
{
object obj = translator.getNetObject (luaState, stackPos);
......
......@@ -39,14 +39,14 @@ namespace NLua.Event
/// <author>Reinhard Ostermeier</author>
public class DebugHookEventArgs : EventArgs
{
private readonly LuaCore.lua_Debug luaDebug;
private readonly LuaCore.LuaDebug luaDebug;
public DebugHookEventArgs (LuaCore.lua_Debug luaDebug)
public DebugHookEventArgs (LuaCore.LuaDebug luaDebug)
{
this.luaDebug = luaDebug;
}
public LuaCore.lua_Debug LuaDebug {
public LuaCore.LuaDebug LuaDebug {
get { return luaDebug; }
}
}
......
......@@ -50,7 +50,7 @@ namespace NLua
this.klass = klass;
}
public object extractGenerated (LuaCore.lua_State luaState, int stackPos)
public object extractGenerated (LuaCore.LuaState luaState, int stackPos)
{
return CodeGeneration.Instance.GetClassInstance (klass, translator.getTable (luaState, stackPos));
}
......
......@@ -51,7 +51,7 @@ namespace NLua
this.delegateType = delegateType;
}
public object extractGenerated (LuaCore.lua_State luaState, int stackPos)
public object extractGenerated (LuaCore.LuaState luaState, int stackPos)
{
return CodeGeneration.Instance.GetDelegate (delegateType, translator.getFunction (luaState, stackPos));
}
......
......@@ -75,19 +75,19 @@ namespace NLua
/// lua hook calback delegate
/// </summary>
/// <author>Reinhard Ostermeier</author>
private LuaCore.lua_Hook hookCallback = null;
private LuaCore.LuaHook hookCallback = null;
#endregion
#region Globals auto-complete
private readonly List<string> globals = new List<string> ();
private bool globalsSorted;
#endregion
private /*readonly */ LuaCore.lua_State luaState;
private /*readonly */ LuaCore.LuaState luaState;
/// <summary>
/// True while a script is being executed
/// </summary>
public bool IsExecuting { get { return executing; } }
private LuaCore.lua_CFunction panicCallback;
private LuaCore.LuaNativeFunction panicCallback;
private ObjectTranslator translator;
/// <summary>
/// Used to ensure multiple .net threads all get serialized by this single lock for access to the lua stack/objects
......@@ -267,14 +267,14 @@ end
LuaLib.luaL_openlibs (luaState); // steffenj: Lua 5.1.1 API change (luaopen_base is gone, just open all libs right here)
Init (luaState);
// We need to keep this in a managed reference so the delegate doesn't get garbage collected
panicCallback = new LuaCore.lua_CFunction (PanicCallback);
panicCallback = new LuaCore.LuaNativeFunction (PanicCallback);
LuaLib.lua_atpanic (luaState, panicCallback);
}
/*
* CAUTION: NLua.Lua instances can't share the same lua state!
*/
public Lua (LuaCore.lua_State lState)
public Lua (LuaCore.LuaState lState)
{
LuaLib.lua_pushstring (lState, "LUAINTERFACE LOADED");
LuaLib.lua_gettable (lState, (int)LuaIndexes.Registry);
......@@ -290,7 +290,7 @@ end
}
}
void Init (LuaCore.lua_State luaState)
void Init (LuaCore.LuaState luaState)
{
LuaLib.lua_pushstring (luaState, "LUAINTERFACE LOADED");
LuaLib.lua_pushboolean (luaState, true);
......@@ -317,17 +317,17 @@ end
return;
if (!luaState.IsNull ()) {
LuaCore.lua_close (luaState);
LuaCore.LuaClose (luaState);
ObjectTranslatorPool.Instance.Remove (luaState);
}
//luaState = LuaCore.lua_State.Zero; <- suggested by Christopher Cebulski http://luaforge.net/forum/forum.php?thread_id = 44593&forum_id = 146
//luaState = LuaCore.LuaState.Zero; <- suggested by Christopher Cebulski http://luaforge.net/forum/forum.php?thread_id = 44593&forum_id = 146
}
#if MONOTOUCH
[MonoTouch.MonoPInvokeCallback (typeof (LuaCore.lua_CFunction))]
#endif
[System.Runtime.InteropServices.AllowReversePInvokeCalls]
static int PanicCallback (LuaCore.lua_State luaState)
static int PanicCallback (LuaCore.LuaState luaState)
{
string reason = string.Format ("unprotected error in call to Lua API ({0})", LuaLib.lua_tostring (luaState, -1));
throw new LuaException (reason);
......@@ -582,7 +582,7 @@ end
private void registerGlobal (string path, Type type, int recursionCounter)
{
// If the type is a global method, list it directly
if (type == typeof(LuaCore.lua_CFunction)) {
if (type == typeof(LuaCore.LuaNativeFunction)) {
// Format for easy method invocation
globals.Add (path + "(");
}
......@@ -704,7 +704,7 @@ end
public LuaFunction GetFunction (string fullPath)
{
object obj = this [fullPath];
return (obj is LuaCore.lua_CFunction ? new LuaFunction ((LuaCore.lua_CFunction)obj, this) : (LuaFunction)obj);
return (obj is LuaCore.LuaNativeFunction ? new LuaFunction ((LuaCore.LuaNativeFunction)obj, this) : (LuaFunction)obj);
}
/*
......@@ -852,8 +852,8 @@ end
public int SetDebugHook (EventMasks mask, int count)
{
if (hookCallback.IsNull ()) {
hookCallback = new LuaCore.lua_Hook (Lua.DebugHookCallback);
return LuaCore.lua_sethook (luaState, hookCallback, (int)mask, count);
hookCallback = new LuaCore.LuaHook (Lua.DebugHookCallback);
return LuaCore.LuaSetHook (luaState, hookCallback, (int)mask, count);
}
return -1;
......@@ -867,7 +867,7 @@ end
public int RemoveDebugHook ()
{
hookCallback = null;
return LuaCore.lua_sethook (luaState, null, 0, 0);
return LuaCore.LuaSetHook (luaState, null, 0, 0);
}
/// <summary>
......@@ -877,7 +877,7 @@ end
/// <author>Reinhard Ostermeier</author>
public EventMasks GetHookMask ()
{
return (EventMasks)LuaCore.lua_gethookmask (luaState);
return (EventMasks)LuaCore.LuaGetHookMask (luaState);
}
/// <summary>
......@@ -887,7 +887,7 @@ end
/// <author>Reinhard Ostermeier</author>
public int GetHookCount ()
{
return LuaCore.lua_gethookcount (luaState);
return LuaCore.LuaGetHookCount (luaState);
}
/// <summary>
......@@ -900,7 +900,7 @@ end
/*public bool GetStack(int level, out LuaCore.lua_Debug luaDebug)
{
luaDebug = new LuaDebug();
LuaCore.lua_State ld = System.Runtime.InteropServices.Marshal.AllocHGlobal(System.Runtime.InteropServices.Marshal.SizeOf(luaDebug));
LuaCore.LuaState ld = System.Runtime.InteropServices.Marshal.AllocHGlobal(System.Runtime.InteropServices.Marshal.SizeOf(luaDebug));
System.Runtime.InteropServices.Marshal.StructureToPtr(luaDebug, ld, false);
try
{
......@@ -922,7 +922,7 @@ end
/// <author>Reinhard Ostermeier</author>
/*public int GetInfo(String what, ref LuaCore.lua_Debug luaDebug)
{
LuaCore.lua_State ld = System.Runtime.InteropServices.Marshal.AllocHGlobal(System.Runtime.InteropServices.Marshal.SizeOf(luaDebug));
LuaCore.LuaState ld = System.Runtime.InteropServices.Marshal.AllocHGlobal(System.Runtime.InteropServices.Marshal.SizeOf(luaDebug));
System.Runtime.InteropServices.Marshal.StructureToPtr(luaDebug, ld, false);
try
{
......@@ -942,9 +942,9 @@ end
/// <param name = "n">see lua docs</param>
/// <returns>see lua docs</returns>
/// <author>Reinhard Ostermeier</author>
public string GetLocal (LuaCore.lua_Debug luaDebug, int n)
public string GetLocal (LuaCore.LuaDebug luaDebug, int n)
{
return LuaCore.lua_getlocal (luaState, luaDebug, n).ToString ();
return LuaCore.LuaGetLocal (luaState, luaDebug, n).ToString ();
}
/// <summary>
......@@ -954,9 +954,9 @@ end
/// <param name = "n">see lua docs</param>
/// <returns>see lua docs</returns>
/// <author>Reinhard Ostermeier</author>
public string SetLocal (LuaCore.lua_Debug luaDebug, int n)
public string SetLocal (LuaCore.LuaDebug luaDebug, int n)
{
return LuaCore.lua_setlocal (luaState, luaDebug, n).ToString ();
return LuaCore.LuaSetLocal (luaState, luaDebug, n).ToString ();
}
/// <summary>
......@@ -968,7 +968,7 @@ end
/// <author>Reinhard Ostermeier</author>
public string GetUpValue (int funcindex, int n)
{
return LuaCore.lua_getupvalue (luaState, funcindex, n).ToString ();
return LuaCore.LuaGetUpValue (luaState, funcindex, n).ToString ();
}
/// <summary>
......@@ -980,7 +980,7 @@ end
/// <author>Reinhard Ostermeier</author>
public string SetUpValue (int funcindex, int n)
{
return LuaCore.lua_setupvalue (luaState, funcindex, n).ToString ();
return LuaCore.LuaSetUpValue (luaState, funcindex, n).ToString ();
}
/// <summary>
......@@ -994,7 +994,7 @@ end
[MonoTouch.MonoPInvokeCallback (typeof (LuaCore.lua_Hook))]
#endif
[System.Runtime.InteropServices.AllowReversePInvokeCalls]
private static void DebugHookCallback (LuaCore.lua_State luaState, LuaCore.lua_Debug luaDebug)
private static void DebugHookCallback (LuaCore.LuaState luaState, LuaCore.LuaDebug luaDebug)
{
var translator = ObjectTranslatorPool.Instance.Find (luaState);
var lua = translator.Interpreter;
......@@ -1002,7 +1002,7 @@ end
lua.DebugHookCallbackInternal (luaState, luaDebug);
}
private void DebugHookCallbackInternal (LuaCore.lua_State luaState, LuaCore.lua_Debug luaDebug)
private void DebugHookCallbackInternal (LuaCore.LuaState luaState, LuaCore.LuaDebug luaDebug)
{
try {
var temp = DebugHook;
......@@ -1131,7 +1131,7 @@ end
// We leave nothing on the stack when we are done
int oldTop = LuaLib.lua_gettop (luaState);
var wrapper = new LuaMethodWrapper (translator, target, function.DeclaringType, function);
translator.push (luaState, new LuaCore.lua_CFunction (wrapper.invokeFunction));
translator.push (luaState, new LuaCore.LuaNativeFunction (wrapper.invokeFunction));
this [path] = translator.getObject (luaState, -1);
var f = GetFunction (path);
LuaLib.lua_settop (luaState, oldTop);
......@@ -1151,7 +1151,7 @@ end
return (equal != 0);
}
internal void pushCSFunction (LuaCore.lua_CFunction function)
internal void pushCSFunction (LuaCore.LuaNativeFunction function)
{
translator.pushFunction (luaState, function);
}
......
......@@ -37,7 +37,7 @@ namespace NLua
public class LuaFunction : LuaBase
{
internal LuaCore.lua_CFunction function;
internal LuaCore.LuaNativeFunction function;
public LuaFunction (int reference, Lua interpreter)
{
......@@ -46,7 +46,7 @@ namespace NLua
_Interpreter = interpreter;
}
public LuaFunction (LuaCore.lua_CFunction function, Lua interpreter)
public LuaFunction (LuaCore.LuaNativeFunction function, Lua interpreter)
{
_Reference = 0;
this.function = function;
......@@ -74,7 +74,7 @@ namespace NLua
/*
* Pushes the function into the Lua stack
*/
internal void push (LuaCore.lua_State luaState)
internal void push (LuaCore.LuaState luaState)
{
if (_Reference != 0)
LuaLib.lua_getref (luaState, _Reference);
......
......@@ -41,7 +41,7 @@ namespace NLua
{
if (registryIndex != 0)
return registryIndex;
registryIndex = LuaCore.luanet_registryindex ();
registryIndex = LuaCore.LuaNetRegistryIndex ();
return registryIndex;
}
}
......
......@@ -39,56 +39,56 @@ namespace NLua
public class LuaLib
{
// steffenj: BEGIN additional Lua API functions new in Lua 5.1
public static int lua_gc (LuaCore.lua_State luaState, GCOptions what, int data)
public static int lua_gc (LuaCore.LuaState luaState, GCOptions what, int data)
{
return LuaCore.lua_gc (luaState, (int)what, data);
return LuaCore.LuaGC (luaState, (int)what, data);
}
public static string lua_typename (LuaCore.lua_State luaState, LuaTypes type)
public static string lua_typename (LuaCore.LuaState luaState, LuaTypes type)
{
return LuaCore.lua_typename (luaState, (int)type).ToString ();
return LuaCore.LuaTypeName (luaState, (int)type).ToString ();
}
public static string luaL_typename (LuaCore.lua_State luaState, int stackPos)
public static string luaL_typename (LuaCore.LuaState luaState, int stackPos)
{
return lua_typename (luaState, lua_type (luaState, stackPos));
}
public static void luaL_error (LuaCore.lua_State luaState, string message)
public static void luaL_error (LuaCore.LuaState luaState, string message)
{
LuaCore.luaL_error (luaState, message);
LuaCore.LuaLError (luaState, message);
}
public static void luaL_where (LuaCore.lua_State luaState, int level)
public static void luaL_where (LuaCore.LuaState luaState, int level)
{
LuaCore.luaL_where (luaState, level);
LuaCore.LuaLWhere (luaState, level);
}
// steffenj: BEGIN Lua 5.1.1 API change (lua_open replaced by luaL_newstate)
public static LuaCore.lua_State luaL_newstate ()
public static LuaCore.LuaState luaL_newstate ()
{
return LuaCore.luaL_newstate ();
return LuaCore.LuaLNewState ();
}
// steffenj: BEGIN Lua 5.1.1 API change (new function luaL_openlibs)
public static void luaL_openlibs (LuaCore.lua_State luaState)
public static void luaL_openlibs (LuaCore.LuaState luaState)
{
LuaCore.luaL_openlibs (luaState);
LuaCore.LuaLOpenLibs (luaState);
}
// steffenj: END Lua 5.1.1 API change (lua_strlen is now lua_objlen)
// steffenj: BEGIN Lua 5.1.1 API change (lua_dostring is now a macro luaL_dostring)
public static int luaL_loadstring (LuaCore.lua_State luaState, string chunk)
public static int luaL_loadstring (LuaCore.LuaState luaState, string chunk)
{
return LuaCore.luaL_loadstring (luaState, chunk);
return LuaCore.LuaLLoadString (luaState, chunk);
}
public static int luaL_loadstring (LuaCore.lua_State luaState, byte[] chunk)
public static int luaL_loadstring (LuaCore.LuaState luaState, byte[] chunk)
{
return LuaCore.luaL_loadstring (luaState, chunk);
return LuaCore.LuaLLoadString (luaState, chunk);
}
public static int luaL_dostring (LuaCore.lua_State luaState, string chunk)
public static int luaL_dostring (LuaCore.LuaState luaState, string chunk)
{
int result = luaL_loadstring (luaState, chunk);
if (result != 0)
......@@ -97,7 +97,7 @@ namespace NLua
return lua_pcall (luaState, 0, -1, 0);
}
public static int luaL_dostring (LuaCore.lua_State luaState, byte[] chunk)
public static int luaL_dostring (LuaCore.LuaState luaState, byte[] chunk)
{
int result = luaL_loadstring (luaState, chunk);
if (result != 0)
......@@ -106,221 +106,221 @@ namespace NLua
return lua_pcall (luaState, 0, -1, 0);
}
/// <summary>DEPRECATED - use luaL_dostring(LuaCore.lua_State luaState, string chunk) instead!</summary>
public static int lua_dostring (LuaCore.lua_State luaState, string chunk)
/// <summary>DEPRECATED - use luaL_dostring(LuaCore.LuaState luaState, string chunk) instead!</summary>
public static int lua_dostring (LuaCore.LuaState luaState, string chunk)
{
return luaL_dostring (luaState, chunk);
}
// steffenj: END Lua 5.1.1 API change (lua_dostring is now a macro luaL_dostring)
// steffenj: BEGIN Lua 5.1.1 API change (lua_newtable is gone, lua_createtable is new)
public static void lua_createtable (LuaCore.lua_State luaState, int narr, int nrec)
public static void lua_createtable (LuaCore.LuaState luaState, int narr, int nrec)
{
LuaCore.lua_createtable (luaState, narr, nrec);
LuaCore.LuaCreateTable (luaState, narr, nrec);
}
public static void lua_newtable (LuaCore.lua_State luaState)
public static void lua_newtable (LuaCore.LuaState luaState)
{
lua_createtable (luaState, 0, 0);
}
// steffenj: END Lua 5.1.1 API change (lua_newtable is gone, lua_createtable is new)
// steffenj: BEGIN Lua 5.1.1 API change (lua_dofile now in LuaLib as luaL_dofile macro)
public static int luaL_dofile (LuaCore.lua_State luaState, string fileName)
public static int luaL_dofile (LuaCore.LuaState luaState, string fileName)
{
int result = LuaCore.luanet_loadfile (luaState, fileName);
int result = LuaCore.LuaNetLoadFile (luaState, fileName);
if (result != 0)
return result;
return LuaCore.luanet_pcall (luaState, 0, -1, 0);
return LuaCore.LuaNetPCall (luaState, 0, -1, 0);
}
public static void lua_getglobal (LuaCore.lua_State luaState, string name)
public static void lua_getglobal (LuaCore.LuaState luaState, string name)
{
LuaCore.luanet_getglobal (luaState, name);
LuaCore.LuaNetGetGlobal (luaState, name);
}
public static void lua_setglobal (LuaCore.lua_State luaState, string name)
public static void lua_setglobal (LuaCore.LuaState luaState, string name)
{
LuaCore.luanet_setglobal (luaState, name);
LuaCore.LuaNetSetGlobal (luaState, name);
}
public static void lua_settop (LuaCore.lua_State luaState, int newTop)
public static void lua_settop (LuaCore.LuaState luaState, int newTop)
{
LuaCore.lua_settop (luaState, newTop);
LuaCore.LuaSetTop (luaState, newTop);
}
public static void lua_pop (LuaCore.lua_State luaState, int amount)
public static void lua_pop (LuaCore.LuaState luaState, int amount)
{
lua_settop (luaState, -(amount) - 1);
}
public static void lua_insert (LuaCore.lua_State luaState, int newTop)
public static void lua_insert (LuaCore.LuaState luaState, int newTop)
{
LuaCore.lua_insert (luaState, newTop);
LuaCore.LuaInsert (luaState, newTop);
}
public static void lua_remove (LuaCore.lua_State luaState, int index)
public static void lua_remove (LuaCore.LuaState luaState, int index)
{
LuaCore.lua_remove (luaState, index);
LuaCore.LuaRemove (luaState, index);
}
public static void lua_gettable (LuaCore.lua_State luaState, int index)
public static void lua_gettable (LuaCore.LuaState luaState, int index)
{
LuaCore.lua_gettable (luaState, index);
LuaCore.LuaGetTable (luaState, index);
}
public static void lua_rawget (LuaCore.lua_State luaState, int index)
public static void lua_rawget (LuaCore.LuaState luaState, int index)
{
LuaCore.lua_rawget (luaState, index);
LuaCore.LuaRawGet (luaState, index);
}
public static void lua_settable (LuaCore.lua_State luaState, int index)
public static void lua_settable (LuaCore.LuaState luaState, int index)
{
LuaCore.lua_settable (luaState, index);
LuaCore.LuaSetTable (luaState, index);
}
public static void lua_rawset (LuaCore.lua_State luaState, int index)
public static void lua_rawset (LuaCore.LuaState luaState, int index)
{
LuaCore.lua_rawset (luaState, index);
LuaCore.LuaRawSet (luaState, index);
}
public static void lua_setmetatable (LuaCore.lua_State luaState, int objIndex)
public static void lua_setmetatable (LuaCore.LuaState luaState, int objIndex)
{
LuaCore.lua_setmetatable (luaState, objIndex);
LuaCore.LuaSetMetatable (luaState, objIndex);
}
public static int lua_getmetatable (LuaCore.lua_State luaState, int objIndex)
public static int lua_getmetatable (LuaCore.LuaState luaState, int objIndex)
{
return LuaCore.lua_getmetatable (luaState, objIndex);
return LuaCore.LuaGetMetatable (luaState, objIndex);
}
public static int lua_equal (LuaCore.lua_State luaState, int index1, int index2)
public static int lua_equal (LuaCore.LuaState luaState, int index1, int index2)
{
return LuaCore.lua_equal (luaState, index1, index2);
return LuaCore.LuaNetEqual (luaState, index1, index2);
}
public static void lua_pushvalue (LuaCore.lua_State luaState, int index)
public static void lua_pushvalue (LuaCore.LuaState luaState, int index)
{
LuaCore.lua_pushvalue (luaState, index);
LuaCore.LuaPushValue (luaState, index);
}
public static void lua_replace (LuaCore.lua_State luaState, int index)
public static void lua_replace (LuaCore.LuaState luaState, int index)
{
LuaCore.lua_replace (luaState, index);
LuaCore.LuaReplace (luaState, index);
}
public static int lua_gettop (LuaCore.lua_State luaState)
public static int lua_gettop (LuaCore.LuaState luaState)
{
return LuaCore.lua_gettop (luaState);
return LuaCore.LuaGetTop (luaState);
}
public static LuaTypes lua_type (LuaCore.lua_State luaState, int index)
public static LuaTypes lua_type (LuaCore.LuaState luaState, int index)
{
return (LuaTypes)LuaCore.lua_type (luaState, index);
return (LuaTypes)LuaCore.LuaType (luaState, index);
}
public static bool lua_isnil (LuaCore.lua_State luaState, int index)
public static bool lua_isnil (LuaCore.LuaState luaState, int index)
{
return lua_type (luaState, index) == LuaTypes.Nil;
}
public static bool lua_isnumber (LuaCore.lua_State luaState, int index)
public static bool lua_isnumber (LuaCore.LuaState luaState, int index)
{
return lua_type (luaState, index) == LuaTypes.Number;
}
public static bool lua_isboolean (LuaCore.lua_State luaState, int index)
public static bool lua_isboolean (LuaCore.LuaState luaState, int index)
{
return lua_type (luaState, index) == LuaTypes.Boolean;
}
public static int luaL_ref (LuaCore.lua_State luaState, int registryIndex)
public static int luaL_ref (LuaCore.LuaState luaState, int registryIndex)
{
return LuaCore.luaL_ref (luaState, registryIndex);
return LuaCore.LuaLRef (luaState, registryIndex);
}
public static int lua_ref (LuaCore.lua_State luaState, int lockRef)
public static int lua_ref (LuaCore.LuaState luaState, int lockRef)
{
return lockRef != 0 ? luaL_ref (luaState, (int)LuaIndexes.Registry) : 0;
}
public static void lua_rawgeti (LuaCore.lua_State luaState, int tableIndex, int index)
public static void lua_rawgeti (LuaCore.LuaState luaState, int tableIndex, int index)
{
LuaCore.lua_rawgeti (luaState, tableIndex, index);
LuaCore.LuaRawGetI (luaState, tableIndex, index);
}
public static void lua_rawseti (LuaCore.lua_State luaState, int tableIndex, int index)
public static void lua_rawseti (LuaCore.LuaState luaState, int tableIndex, int index)
{
LuaCore.lua_rawseti (luaState, tableIndex, index);
LuaCore.LuaRawSetI (luaState, tableIndex, index);
}
public static object lua_newuserdata (LuaCore.lua_State luaState, int size)
public static object lua_newuserdata (LuaCore.LuaState luaState, int size)
{
return LuaCore.lua_newuserdata (luaState, (uint)size);
return LuaCore.LuaNewUserData (luaState, (uint)size);
}
public static object lua_touserdata (LuaCore.lua_State luaState, int index)
public static object lua_touserdata (LuaCore.LuaState luaState, int index)
{
return LuaCore.lua_touserdata (luaState, index);
return LuaCore.LuaToUserData (luaState, index);
}
public static void lua_getref (LuaCore.lua_State luaState, int reference)
public static void lua_getref (LuaCore.LuaState luaState, int reference)
{
lua_rawgeti (luaState, (int)LuaIndexes.Registry, reference);
}
public static void lua_unref (LuaCore.lua_State luaState, int reference)
public static void lua_unref (LuaCore.LuaState luaState, int reference)
{
LuaCore.luaL_unref (luaState, (int)LuaIndexes.Registry, reference);
LuaCore.LuaLUnref (luaState, (int)LuaIndexes.Registry, reference);
}
public static bool lua_isstring (LuaCore.lua_State luaState, int index)
public static bool lua_isstring (LuaCore.LuaState luaState, int index)
{
return LuaCore.lua_isstring (luaState, index) != 0;
return LuaCore.LuaIsString (luaState, index) != 0;
}
public static bool lua_iscfunction (LuaCore.lua_State luaState, int index)
public static bool lua_iscfunction (LuaCore.LuaState luaState, int index)
{
return LuaCore.lua_iscfunction (luaState, index);
return LuaCore.LuaIsCFunction (luaState, index);
}
public static void lua_pushnil (LuaCore.lua_State luaState)
public static void lua_pushnil (LuaCore.LuaState luaState)
{
LuaCore.lua_pushnil (luaState);
LuaCore.LuaPushNil (luaState);
}
public static void lua_call (LuaCore.lua_State luaState, int nArgs, int nResults)
public static void lua_call (LuaCore.LuaState luaState, int nArgs, int nResults)
{
LuaCore.lua_call (luaState, nArgs, nResults);
LuaCore.LuaCall (luaState, nArgs, nResults);
}
public static void lua_pushstdcallcfunction (LuaCore.lua_State luaState, LuaCore.lua_CFunction function)
public static void lua_pushstdcallcfunction (LuaCore.LuaState luaState, LuaCore.LuaNativeFunction function)
{
LuaCore.lua_pushcfunction (luaState, function);
LuaCore.LuaPushStdCallCFunction (luaState, function);
}
public static int lua_pcall (LuaCore.lua_State luaState, int nArgs, int nResults, int errfunc)
public static int lua_pcall (LuaCore.LuaState luaState, int nArgs, int nResults, int errfunc)
{
return LuaCore.luanet_pcall (luaState, nArgs, nResults, errfunc);
return LuaCore.LuaNetPCall (luaState, nArgs, nResults, errfunc);
}
public static LuaCore.lua_CFunction lua_tocfunction (LuaCore.lua_State luaState, int index)
public static LuaCore.LuaNativeFunction lua_tocfunction (LuaCore.LuaState luaState, int index)
{
return LuaCore.lua_tocfunction (luaState, index);
return LuaCore.LuaToCFunction (luaState, index);
}
public static double lua_tonumber (LuaCore.lua_State luaState, int index)
public static double lua_tonumber (LuaCore.LuaState luaState, int index)
{
return LuaCore.luanet_tonumber (luaState, index);
return LuaCore.LuaNetToNumber (luaState, index);
}
public static bool lua_toboolean (LuaCore.lua_State luaState, int index)
public static bool lua_toboolean (LuaCore.LuaState luaState, int index)
{
return LuaCore.lua_toboolean (luaState, index) != 0;
return LuaCore.LuaToBoolean (luaState, index) != 0;
}
public static string lua_tostring (LuaCore.lua_State luaState, int index)
public static string lua_tostring (LuaCore.LuaState luaState, int index)
{
#if true
// FIXME use the same format string as lua i.e. LUA_NUMBER_FMT
......@@ -336,7 +336,7 @@ namespace NLua
// So we use the ToString method with string length, so it could be checked,
// if string is a binary chunk and if, could transfered to string without
// encoding.
return LuaCore.lua_tolstring (luaState, index, out strlen).ToString ((int)strlen);
return LuaCore.LuaToLString (luaState, index, out strlen).ToString ((int)strlen);
} else if (t == LuaTypes.Nil)
return null; // treat lua nulls to as C# nulls
else
......@@ -354,131 +354,131 @@ namespace NLua
#endif
}
public static void lua_atpanic (LuaCore.lua_State luaState, LuaCore.lua_CFunction panicf)
public static void lua_atpanic (LuaCore.LuaState luaState, LuaCore.LuaNativeFunction panicf)
{
LuaCore.lua_atpanic (luaState, (LuaCore.lua_CFunction)panicf);
LuaCore.LuaAtPanic (luaState, (LuaCore.LuaNativeFunction)panicf);
}
public static void lua_pushnumber (LuaCore.lua_State luaState, double number)
public static void lua_pushnumber (LuaCore.LuaState luaState, double number)
{
LuaCore.lua_pushnumber (luaState, number);
LuaCore.LuaPushNumber (luaState, number);
}
public static void lua_pushboolean (LuaCore.lua_State luaState, bool value)
public static void lua_pushboolean (LuaCore.LuaState luaState, bool value)
{
LuaCore.lua_pushboolean (luaState, value ? 1 : 0);
LuaCore.LuaPushBoolean (luaState, value ? 1 : 0);
}
public static void lua_pushstring (LuaCore.lua_State luaState, string str)
public static void lua_pushstring (LuaCore.LuaState luaState, string str)
{
LuaCore.lua_pushstring (luaState, str);
LuaCore.LuaPushString (luaState, str);
}
public static int luaL_newmetatable (LuaCore.lua_State luaState, string meta)
public static int luaL_newmetatable (LuaCore.LuaState luaState, string meta)
{
return LuaCore.luaL_newmetatable (luaState, meta);
return LuaCore.LuaLNewMetatable (luaState, meta);
}
// steffenj: BEGIN Lua 5.1.1 API change (luaL_getmetatable is now a macro using lua_getfield)
public static void lua_getfield (LuaCore.lua_State luaState, int stackPos, string meta)
public static void lua_getfield (LuaCore.LuaState luaState, int stackPos, string meta)
{
LuaCore.lua_getfield (luaState, stackPos, meta);
LuaCore.LuaGetField (luaState, stackPos, meta);
}
public static void luaL_getmetatable (LuaCore.lua_State luaState, string meta)
public static void luaL_getmetatable (LuaCore.LuaState luaState, string meta)
{
lua_getfield (luaState, (int)LuaIndexes.Registry, meta);
}
public static object luaL_checkudata (LuaCore.lua_State luaState, int stackPos, string meta)
public static object luaL_checkudata (LuaCore.LuaState luaState, int stackPos, string meta)
{
return LuaCore.luaL_checkudata (luaState, stackPos, meta);
return LuaCore.LuaLCheckUData (luaState, stackPos, meta);
}
public static bool luaL_getmetafield (LuaCore.lua_State luaState, int stackPos, string field)
public static bool luaL_getmetafield (LuaCore.LuaState luaState, int stackPos, string field)
{
return LuaCore.luaL_getmetafield (luaState, stackPos, field) != 0;
return LuaCore.LuaLGetMetafield (luaState, stackPos, field) != 0;
}
public static int luaL_loadbuffer (LuaCore.lua_State luaState, string buff, string name)
public static int luaL_loadbuffer (LuaCore.LuaState luaState, string buff, string name)
{
return LuaCore.luanet_loadbuffer (luaState, buff, (uint)buff.Length, name);
return LuaCore.LuaNetLoadBuffer (luaState, buff, (uint)buff.Length, name);
}
public static int luaL_loadbuffer (LuaCore.lua_State luaState, byte [] buff, string name)
public static int luaL_loadbuffer (LuaCore.LuaState luaState, byte [] buff, string name)
{
return LuaCore.luanet_loadbuffer (luaState, buff, (uint)buff.Length, name);
return LuaCore.LuaNetLoadBuffer (luaState, buff, (uint)buff.Length, name);
}
public static int luaL_loadfile (LuaCore.lua_State luaState, string filename)
public static int luaL_loadfile (LuaCore.LuaState luaState, string filename)
{
return LuaCore.luanet_loadfile (luaState, filename);
return LuaCore.LuaNetLoadFile (luaState, filename);
}
public static bool luaL_checkmetatable (LuaCore.lua_State luaState, int index)
public static bool luaL_checkmetatable (LuaCore.LuaState luaState, int index)
{
return LuaCore.luaL_checkmetatable (luaState, index);
return LuaCore.LuaLCheckMetatable (luaState, index);
}
public static int luanet_registryindex ()
{
return LuaCore.luanet_registryindex ();
return LuaCore.LuaNetRegistryIndex ();
}
public static int luanet_tonetobject (LuaCore.lua_State luaState, int index)
public static int luanet_tonetobject (LuaCore.LuaState luaState, int index)
{
return LuaCore.luanet_tonetobject (luaState, index);
return LuaCore.LuaNetToNetObject (luaState, index);
}
public static void luanet_newudata (LuaCore.lua_State luaState, int val)
public static void luanet_newudata (LuaCore.LuaState luaState, int val)
{
LuaCore.luanet_newudata (luaState, val);
LuaCore.LuaNetNewUData (luaState, val);
}
public static int luanet_rawnetobj (LuaCore.lua_State luaState, int obj)
public static int luanet_rawnetobj (LuaCore.LuaState luaState, int obj)
{
return LuaCore.luanet_rawnetobj (luaState, obj);
return LuaCore.LuaNetRawNetObj (luaState, obj);
}
public static int luanet_checkudata (LuaCore.lua_State luaState, int ud, string tname)
public static int luanet_checkudata (LuaCore.LuaState luaState, int ud, string tname)
{
return LuaCore.luanet_checkudata (luaState, ud, tname);
return LuaCore.LuaNetCheckUData (luaState, ud, tname);
}
public static void lua_error (LuaCore.lua_State luaState)
public static void lua_error (LuaCore.LuaState luaState)
{
LuaCore.lua_error (luaState);
LuaCore.LuaError (luaState);
}
public static bool lua_checkstack (LuaCore.lua_State luaState, int extra)
public static bool lua_checkstack (LuaCore.LuaState luaState, int extra)
{
return LuaCore.lua_checkstack (luaState, extra) != 0;
return LuaCore.LuaCheckStack (luaState, extra) != 0;
}
public static int lua_next (LuaCore.lua_State luaState, int index)
public static int lua_next (LuaCore.LuaState luaState, int index)
{
return LuaCore.lua_next (luaState, index);
return LuaCore.LuaNext (luaState, index);
}
public static void lua_pushlightuserdata (LuaCore.lua_State luaState, LuaCore.LuaTag udata)
public static void lua_pushlightuserdata (LuaCore.LuaState luaState, LuaCore.LuaTag udata)
{
LuaCore.lua_pushlightuserdata (luaState, udata.Tag);
LuaCore.LuaPushLightUserData (luaState, udata.Tag);
}
public static LuaCore.LuaTag luanet_gettag ()
{
return LuaCore.luanet_gettag ();
return LuaCore.LuaNetGetTag ();
}
public static void luanet_pushglobaltable (LuaCore.lua_State luaState)
public static void luanet_pushglobaltable (LuaCore.LuaState luaState)
{
LuaCore.luanet_pushglobaltable (luaState);
LuaCore.LuaNetPushGlobalTable (luaState);
}
public static void luanet_popglobaltable (LuaCore.lua_State luaState)
public static void luanet_popglobaltable (LuaCore.LuaState luaState)
{
LuaCore.luanet_popglobaltable (luaState);
LuaCore.LuaNetPopGlobalTable (luaState);
}
}
......
......@@ -100,8 +100,8 @@ namespace NLua
{
object obj = _Interpreter.rawGetObject (_Reference, field);
if (obj is LuaCore.lua_CFunction)
return new LuaFunction ((LuaCore.lua_CFunction)obj, _Interpreter);
if (obj is LuaCore.LuaNativeFunction)
return new LuaFunction ((LuaCore.LuaNativeFunction)obj, _Interpreter);
else
return obj;
}
......@@ -109,7 +109,7 @@ namespace NLua
/*
* Pushes this table into the Lua stack
*/
internal void push (LuaCore.lua_State luaState)
internal void push (LuaCore.LuaState luaState)
{
LuaLib.lua_getref (luaState, _Reference);
}
......
......@@ -79,7 +79,7 @@ namespace NLua
/*
* Pushes the userdata into the Lua stack
*/
internal void push (LuaCore.lua_State luaState)
internal void push (LuaCore.LuaState luaState)
{
LuaLib.lua_getref (luaState, _Reference);
}
......
......@@ -49,7 +49,7 @@ namespace NLua
*/
public class MetaFunctions
{
internal LuaCore.lua_CFunction gcFunction, indexFunction, newindexFunction, baseIndexFunction,
internal LuaCore.LuaNativeFunction gcFunction, indexFunction, newindexFunction, baseIndexFunction,
classIndexFunction, classNewindexFunction, execDelegateFunction, callConstructorFunction, toStringFunction;
private Dictionary<object, object> memberCache = new Dictionary<object, object> ();
private ObjectTranslator translator;
......@@ -77,15 +77,15 @@ namespace NLua
public MetaFunctions (ObjectTranslator translator)
{
this.translator = translator;
gcFunction = new LuaCore.lua_CFunction (MetaFunctions.collectObject);
toStringFunction = new LuaCore.lua_CFunction (MetaFunctions.toString);
indexFunction = new LuaCore.lua_CFunction (MetaFunctions.getMethod);
newindexFunction = new LuaCore.lua_CFunction (MetaFunctions.setFieldOrProperty);
baseIndexFunction = new LuaCore.lua_CFunction (MetaFunctions.getBaseMethod);
callConstructorFunction = new LuaCore.lua_CFunction (MetaFunctions.callConstructor);
classIndexFunction = new LuaCore.lua_CFunction (MetaFunctions.getClassMethod);
classNewindexFunction = new LuaCore.lua_CFunction (MetaFunctions.setClassFieldOrProperty);
execDelegateFunction = new LuaCore.lua_CFunction (MetaFunctions.runFunctionDelegate);
gcFunction = new LuaCore.LuaNativeFunction (MetaFunctions.collectObject);
toStringFunction = new LuaCore.LuaNativeFunction (MetaFunctions.toString);
indexFunction = new LuaCore.LuaNativeFunction (MetaFunctions.getMethod);
newindexFunction = new LuaCore.LuaNativeFunction (MetaFunctions.setFieldOrProperty);
baseIndexFunction = new LuaCore.LuaNativeFunction (MetaFunctions.getBaseMethod);
callConstructorFunction = new LuaCore.LuaNativeFunction (MetaFunctions.callConstructor);
classIndexFunction = new LuaCore.LuaNativeFunction (MetaFunctions.getClassMethod);
classNewindexFunction = new LuaCore.LuaNativeFunction (MetaFunctions.setClassFieldOrProperty);
execDelegateFunction = new LuaCore.LuaNativeFunction (MetaFunctions.runFunctionDelegate);
}
/*
......@@ -95,15 +95,15 @@ namespace NLua
[MonoTouch.MonoPInvokeCallback (typeof (LuaCore.lua_CFunction))]
#endif
[System.Runtime.InteropServices.AllowReversePInvokeCalls]
private static int runFunctionDelegate (LuaCore.lua_State luaState)
private static int runFunctionDelegate (LuaCore.LuaState luaState)
{
var translator = ObjectTranslatorPool.Instance.Find (luaState);
return runFunctionDelegate (luaState, translator);
}
private static int runFunctionDelegate (LuaCore.lua_State luaState, ObjectTranslator translator)
private static int runFunctionDelegate (LuaCore.LuaState luaState, ObjectTranslator translator)
{
LuaCore.lua_CFunction func = (LuaCore.lua_CFunction)translator.getRawNetObject (luaState, 1);
LuaCore.LuaNativeFunction func = (LuaCore.LuaNativeFunction)translator.getRawNetObject (luaState, 1);
LuaLib.lua_remove (luaState, 1);
return func (luaState);
}
......@@ -115,13 +115,13 @@ namespace NLua
[MonoTouch.MonoPInvokeCallback (typeof (LuaCore.lua_CFunction))]
#endif
[System.Runtime.InteropServices.AllowReversePInvokeCalls]
private static int collectObject (LuaCore.lua_State luaState)
private static int collectObject (LuaCore.LuaState luaState)
{
var translator = ObjectTranslatorPool.Instance.Find (luaState);
return collectObject (luaState, translator);
}
private static int collectObject (LuaCore.lua_State luaState, ObjectTranslator translator)
private static int collectObject (LuaCore.LuaState luaState, ObjectTranslator translator)
{
int udata = LuaLib.luanet_rawnetobj (luaState, 1);
......@@ -138,13 +138,13 @@ namespace NLua
[MonoTouch.MonoPInvokeCallback (typeof (LuaCore.lua_CFunction))]
#endif
[System.Runtime.InteropServices.AllowReversePInvokeCalls]
private static int toString (LuaCore.lua_State luaState)
private static int toString (LuaCore.LuaState luaState)
{
var translator = ObjectTranslatorPool.Instance.Find (luaState);
return toString (luaState, translator);
}
private static int toString (LuaCore.lua_State luaState, ObjectTranslator translator)
private static int toString (LuaCore.LuaState luaState, ObjectTranslator translator)
{
object obj = translator.getRawNetObject (luaState, 1);
......@@ -161,7 +161,7 @@ namespace NLua
/// Debug tool to dump the lua stack
/// </summary>
/// FIXME, move somewhere else
public static void dumpStack (ObjectTranslator translator, LuaCore.lua_State luaState)
public static void dumpStack (ObjectTranslator translator, LuaCore.LuaState luaState)
{
int depth = LuaLib.lua_gettop (luaState);
Debug.WriteLine ("lua stack depth: " + depth);
......@@ -196,14 +196,14 @@ namespace NLua
[MonoTouch.MonoPInvokeCallback (typeof (LuaCore.lua_CFunction))]
#endif
[System.Runtime.InteropServices.AllowReversePInvokeCalls]
private static int getMethod (LuaCore.lua_State luaState)
private static int getMethod (LuaCore.LuaState luaState)
{
var translator = ObjectTranslatorPool.Instance.Find (luaState);
var instance = translator.MetaFunctionsInstance;
return instance.getMethodInternal (luaState);
}
private int getMethodInternal (LuaCore.lua_State luaState)
private int getMethodInternal (LuaCore.LuaState luaState)
{
object obj = translator.getRawNetObject (luaState, 1);
......@@ -297,14 +297,14 @@ namespace NLua
[MonoTouch.MonoPInvokeCallback (typeof (LuaCore.lua_CFunction))]
#endif
[System.Runtime.InteropServices.AllowReversePInvokeCalls]
private static int getBaseMethod (LuaCore.lua_State luaState)
private static int getBaseMethod (LuaCore.LuaState luaState)
{
var translator = ObjectTranslatorPool.Instance.Find (luaState);
var instance = translator.MetaFunctionsInstance;
return instance.getBaseMethodInternal (luaState);
}
private int getBaseMethodInternal (LuaCore.lua_State luaState)
private int getBaseMethodInternal (LuaCore.LuaState luaState)
{
object obj = translator.getRawNetObject (luaState, 1);
......@@ -359,15 +359,15 @@ namespace NLua
* Uses reflection to find members, and stores the reflected MemberInfo object in
* a cache (indexed by the type of the object and the name of the member).
*/
private int getMember (LuaCore.lua_State luaState, IReflect objType, object obj, string methodName, BindingFlags bindingType)
private int getMember (LuaCore.LuaState luaState, IReflect objType, object obj, string methodName, BindingFlags bindingType)
{
bool implicitStatic = false;
MemberInfo member = null;
object cachedMember = checkMemberCache (memberCache, objType, methodName);
//object cachedMember=null;
if (cachedMember is LuaCore.lua_CFunction) {
translator.pushFunction (luaState, (LuaCore.lua_CFunction)cachedMember);
if (cachedMember is LuaCore.LuaNativeFunction) {
translator.pushFunction (luaState, (LuaCore.LuaNativeFunction)cachedMember);
translator.push (luaState, true);
return 2;
} else if (!cachedMember.IsNull ())
......@@ -445,7 +445,7 @@ namespace NLua
translator.pushType (luaState, nestedType);
} else {
// Member type must be 'method'
var wrapper = new LuaCore.lua_CFunction ((new LuaMethodWrapper (translator, objType, methodName, bindingType)).invokeFunction);
var wrapper = new LuaCore.LuaNativeFunction ((new LuaMethodWrapper (translator, objType, methodName, bindingType)).invokeFunction);
if (cachedMember.IsNull ())
setMemberCache (memberCache, objType, methodName, wrapper);
......@@ -519,14 +519,14 @@ namespace NLua
[MonoTouch.MonoPInvokeCallback (typeof (LuaCore.lua_CFunction))]
#endif
[System.Runtime.InteropServices.AllowReversePInvokeCalls]
private static int setFieldOrProperty (LuaCore.lua_State luaState)
private static int setFieldOrProperty (LuaCore.LuaState luaState)
{
var translator = ObjectTranslatorPool.Instance.Find (luaState);
var instance = translator.MetaFunctionsInstance;
return instance.setFieldOrPropertyInternal (luaState);
}
private int setFieldOrPropertyInternal (LuaCore.lua_State luaState)
private int setFieldOrPropertyInternal (LuaCore.LuaState luaState)
{
object target = translator.getRawNetObject (luaState, 1);
......@@ -592,7 +592,7 @@ namespace NLua
/// <param name="target"></param>
/// <param name="bindingType"></param>
/// <returns>false if unable to find the named member, true for success</returns>
private bool trySetMember (LuaCore.lua_State luaState, IReflect targetType, object target, BindingFlags bindingType, out string detailMessage)
private bool trySetMember (LuaCore.LuaState luaState, IReflect targetType, object target, BindingFlags bindingType, out string detailMessage)
{
detailMessage = null; // No error yet
......@@ -661,7 +661,7 @@ namespace NLua
* Writes to fields or properties, either static or instance. Throws an error
* if the operation is invalid.
*/
private int setMember (LuaCore.lua_State luaState, IReflect targetType, object target, BindingFlags bindingType)
private int setMember (LuaCore.LuaState luaState, IReflect targetType, object target, BindingFlags bindingType)
{
string detail;
bool success = trySetMember (luaState, targetType, target, bindingType, out detail);
......@@ -677,7 +677,7 @@ namespace NLua
/// </summary>
/// <param name="e"></param>
/// We try to look into the exception to give the most meaningful description
void ThrowError (LuaCore.lua_State luaState, Exception e)
void ThrowError (LuaCore.LuaState luaState, Exception e)
{
// If we got inside a reflection show what really happened
var te = e as TargetInvocationException;
......@@ -695,14 +695,14 @@ namespace NLua
[MonoTouch.MonoPInvokeCallback (typeof (LuaCore.lua_CFunction))]
#endif
[System.Runtime.InteropServices.AllowReversePInvokeCalls]
private static int getClassMethod (LuaCore.lua_State luaState)
private static int getClassMethod (LuaCore.LuaState luaState)
{
var translator = ObjectTranslatorPool.Instance.Find (luaState);
var instance = translator.MetaFunctionsInstance;
return instance.getClassMethodInternal (luaState);
}
private int getClassMethodInternal (LuaCore.lua_State luaState)
private int getClassMethodInternal (LuaCore.LuaState luaState)
{
IReflect klass;
object obj = translator.getRawNetObject (luaState, 1);
......@@ -737,14 +737,14 @@ namespace NLua
[MonoTouch.MonoPInvokeCallback (typeof (LuaCore.lua_CFunction))]
#endif
[System.Runtime.InteropServices.AllowReversePInvokeCalls]
private static int setClassFieldOrProperty (LuaCore.lua_State luaState)
private static int setClassFieldOrProperty (LuaCore.LuaState luaState)
{
var translator = ObjectTranslatorPool.Instance.Find (luaState);
var instance = translator.MetaFunctionsInstance;
return instance.setClassFieldOrPropertyInternal (luaState);
}
private int setClassFieldOrPropertyInternal (LuaCore.lua_State luaState)
private int setClassFieldOrPropertyInternal (LuaCore.LuaState luaState)
{
IReflect target;
object obj = translator.getRawNetObject (luaState, 1);
......@@ -768,14 +768,14 @@ namespace NLua
[MonoTouch.MonoPInvokeCallback (typeof (LuaCore.lua_CFunction))]
#endif
[System.Runtime.InteropServices.AllowReversePInvokeCalls]
private static int callConstructor (LuaCore.lua_State luaState)
private static int callConstructor (LuaCore.LuaState luaState)
{
var translator = ObjectTranslatorPool.Instance.Find (luaState);
var instance = translator.MetaFunctionsInstance;
return instance.callConstructorInternal (luaState);
}
private int callConstructorInternal (LuaCore.lua_State luaState)
private int callConstructorInternal (LuaCore.LuaState luaState)
{
var validConstructor = new MethodCache ();
IReflect klass;
......@@ -860,7 +860,7 @@ namespace NLua
* if the match was succesful. It it was also returns the information
* necessary to invoke the method.
*/
internal bool matchParameters (LuaCore.lua_State luaState, MethodBase method, ref MethodCache methodCache)
internal bool matchParameters (LuaCore.LuaState luaState, MethodBase method, ref MethodCache methodCache)
{
ExtractValue extractValue;
bool isMethod = true;
......@@ -945,7 +945,7 @@ namespace NLua
/// <param name="currentNetParam"></param>
/// <param name="extractValue"></param>
/// <returns></returns>
private bool _IsTypeCorrect (LuaCore.lua_State luaState, int currentLuaParam, ParameterInfo currentNetParam, out ExtractValue extractValue)
private bool _IsTypeCorrect (LuaCore.LuaState luaState, int currentLuaParam, ParameterInfo currentNetParam, out ExtractValue extractValue)
{
try {
return (extractValue = translator.typeChecker.checkType (luaState, currentLuaParam, currentNetParam.ParameterType)) != null;
......@@ -956,7 +956,7 @@ namespace NLua
}
}
private bool _IsParamsArray (LuaCore.lua_State luaState, int currentLuaParam, ParameterInfo currentNetParam, out ExtractValue extractValue)
private bool _IsParamsArray (LuaCore.LuaState luaState, int currentLuaParam, ParameterInfo currentNetParam, out ExtractValue extractValue)
{
extractValue = null;
......
......@@ -39,7 +39,7 @@ namespace NLua.Method
/*
* Argument extraction with type-conversion function
*/
delegate object ExtractValue (LuaCore.lua_State luaState, int stackPos);
delegate object ExtractValue (LuaCore.LuaState luaState, int stackPos);
/*
* Wrapper class for methods/constructors accessed from Lua.
......@@ -49,7 +49,7 @@ namespace NLua.Method
*/
class LuaMethodWrapper
{
internal LuaCore.lua_CFunction invokeFunction;
internal LuaCore.LuaNativeFunction invokeFunction;
private ObjectTranslator _Translator;
private MethodBase _Method;
private MethodCache _LastCalledMethod = new MethodCache ();
......@@ -64,7 +64,7 @@ namespace NLua.Method
*/
public LuaMethodWrapper (ObjectTranslator translator, object target, IReflect targetType, MethodBase method)
{
invokeFunction = new LuaCore.lua_CFunction (this.call);
invokeFunction = new LuaCore.LuaNativeFunction (this.call);
_Translator = translator;
_Target = target;
......@@ -85,7 +85,7 @@ namespace NLua.Method
*/
public LuaMethodWrapper (ObjectTranslator translator, IReflect targetType, string methodName, BindingFlags bindingType)
{
invokeFunction = new LuaCore.lua_CFunction (this.call);
invokeFunction = new LuaCore.LuaNativeFunction (this.call);
_Translator = translator;
_MethodName = methodName;
......@@ -112,7 +112,7 @@ namespace NLua.Method
* Calls the method. Receives the arguments from the Lua stack
* and returns values in it.
*/
int call (LuaCore.lua_State luaState)
int call (LuaCore.LuaState luaState)
{
var methodToCall = _Method;
object targetObject = _Target;
......
......@@ -49,7 +49,7 @@ namespace NLua
*/
public class ObjectTranslator
{
private LuaCore.lua_CFunction registerTableFunction, unregisterTableFunction, getMethodSigFunction,
private LuaCore.LuaNativeFunction registerTableFunction, unregisterTableFunction, getMethodSigFunction,
getConstructorSigFunction, importTypeFunction, loadAssemblyFunction;
// object to object #
public readonly Dictionary<object, int> objectsBackMap = new Dictionary<object, int> ();
......@@ -77,19 +77,19 @@ namespace NLua
}
}
public ObjectTranslator (Lua interpreter, LuaCore.lua_State luaState)
public ObjectTranslator (Lua interpreter, LuaCore.LuaState luaState)
{
this.interpreter = interpreter;
typeChecker = new CheckType (this);
metaFunctions = new MetaFunctions (this);
assemblies = new List<Assembly> ();
importTypeFunction = new LuaCore.lua_CFunction (ObjectTranslator.importType);
loadAssemblyFunction = new LuaCore.lua_CFunction (ObjectTranslator.loadAssembly);
registerTableFunction = new LuaCore.lua_CFunction (ObjectTranslator.registerTable);
unregisterTableFunction = new LuaCore.lua_CFunction (ObjectTranslator.unregisterTable);
getMethodSigFunction = new LuaCore.lua_CFunction (ObjectTranslator.getMethodSignature);
getConstructorSigFunction = new LuaCore.lua_CFunction (ObjectTranslator.getConstructorSignature);
importTypeFunction = new LuaCore.LuaNativeFunction (ObjectTranslator.importType);
loadAssemblyFunction = new LuaCore.LuaNativeFunction (ObjectTranslator.loadAssembly);
registerTableFunction = new LuaCore.LuaNativeFunction (ObjectTranslator.registerTable);
unregisterTableFunction = new LuaCore.LuaNativeFunction (ObjectTranslator.unregisterTable);
getMethodSigFunction = new LuaCore.LuaNativeFunction (ObjectTranslator.getMethodSignature);
getConstructorSigFunction = new LuaCore.LuaNativeFunction (ObjectTranslator.getConstructorSignature);
createLuaObjectList (luaState);
createIndexingMetaFunction (luaState);
......@@ -102,7 +102,7 @@ namespace NLua
/*
* Sets up the list of objects in the Lua side
*/
private void createLuaObjectList (LuaCore.lua_State luaState)
private void createLuaObjectList (LuaCore.LuaState luaState)
{
LuaLib.lua_pushstring (luaState, "luaNet_objects");
LuaLib.lua_newtable (luaState);
......@@ -118,7 +118,7 @@ namespace NLua
* Registers the indexing function of CLR objects
* passed to Lua
*/
private void createIndexingMetaFunction (LuaCore.lua_State luaState)
private void createIndexingMetaFunction (LuaCore.LuaState luaState)
{
LuaLib.lua_pushstring (luaState, "luaNet_indexfunction");
LuaLib.luaL_dostring (luaState, MetaFunctions.luaIndexFunction); // steffenj: lua_dostring renamed to luaL_dostring
......@@ -129,7 +129,7 @@ namespace NLua
* Creates the metatable for superclasses (the base
* field of registered tables)
*/
private void createBaseClassMetatable (LuaCore.lua_State luaState)
private void createBaseClassMetatable (LuaCore.LuaState luaState)
{
LuaLib.luaL_newmetatable (luaState, "luaNet_searchbase");
LuaLib.lua_pushstring (luaState, "__gc");
......@@ -150,7 +150,7 @@ namespace NLua
/*
* Creates the metatable for type references
*/
private void createClassMetatable (LuaCore.lua_State luaState)
private void createClassMetatable (LuaCore.LuaState luaState)
{
LuaLib.luaL_newmetatable (luaState, "luaNet_class");
LuaLib.lua_pushstring (luaState, "__gc");
......@@ -174,7 +174,7 @@ namespace NLua
/*
* Registers the global functions used by NLua
*/
private void setGlobalFunctions (LuaCore.lua_State luaState)
private void setGlobalFunctions (LuaCore.LuaState luaState)
{
LuaLib.lua_pushstdcallcfunction (luaState, metaFunctions.indexFunction);
LuaLib.lua_setglobal (luaState, "get_object_member");
......@@ -195,7 +195,7 @@ namespace NLua
/*
* Creates the metatable for delegates
*/
private void createFunctionMetatable (LuaCore.lua_State luaState)
private void createFunctionMetatable (LuaCore.LuaState luaState)
{
LuaLib.luaL_newmetatable (luaState, "luaNet_function");
LuaLib.lua_pushstring (luaState, "__gc");
......@@ -210,7 +210,7 @@ namespace NLua
/*
* Passes errors (argument e) to the Lua interpreter
*/
internal void throwError (LuaCore.lua_State luaState, object e)
internal void throwError (LuaCore.LuaState luaState, object e)
{
// We use this to remove anything pushed by luaL_where
int oldTop = LuaLib.lua_gettop (luaState);
......@@ -252,13 +252,13 @@ namespace NLua
[MonoTouch.MonoPInvokeCallback (typeof (LuaCore.lua_CFunction))]
#endif
[System.Runtime.InteropServices.AllowReversePInvokeCalls]
private static int loadAssembly (LuaCore.lua_State luaState)
private static int loadAssembly (LuaCore.LuaState luaState)
{
var translator = ObjectTranslatorPool.Instance.Find (luaState);
return translator.loadAssemblyInternal (luaState);
}
private int loadAssemblyInternal (LuaCore.lua_State luaState)
private int loadAssemblyInternal (LuaCore.LuaState luaState)
{
try {
string assemblyName = LuaLib.lua_tostring (luaState, 1).ToString ();
......@@ -303,13 +303,13 @@ namespace NLua
[MonoTouch.MonoPInvokeCallback (typeof (LuaCore.lua_CFunction))]
#endif
[System.Runtime.InteropServices.AllowReversePInvokeCalls]
private static int importType (LuaCore.lua_State luaState)
private static int importType (LuaCore.LuaState luaState)
{
var translator = ObjectTranslatorPool.Instance.Find (luaState);
return translator.importTypeInternal (luaState);
}
private int importTypeInternal (LuaCore.lua_State luaState)
private int importTypeInternal (LuaCore.LuaState luaState)
{
string className = LuaLib.lua_tostring (luaState, 1).ToString ();
var klass = FindType (className);
......@@ -331,13 +331,13 @@ namespace NLua
[MonoTouch.MonoPInvokeCallback (typeof (LuaCore.lua_CFunction))]
#endif
[System.Runtime.InteropServices.AllowReversePInvokeCalls]
private static int registerTable (LuaCore.lua_State luaState)
private static int registerTable (LuaCore.LuaState luaState)
{
var translator = ObjectTranslatorPool.Instance.Find (luaState);
return translator.registerTableInternal (luaState);
}
private int registerTableInternal (LuaCore.lua_State luaState)
private int registerTableInternal (LuaCore.LuaState luaState)
{
if (LuaLib.lua_type (luaState, 1) == LuaTypes.Table) {
var luaTable = getTable (luaState, 1);
......@@ -383,13 +383,13 @@ namespace NLua
[MonoTouch.MonoPInvokeCallback (typeof (LuaCore.lua_CFunction))]
#endif
[System.Runtime.InteropServices.AllowReversePInvokeCalls]
private static int unregisterTable (LuaCore.lua_State luaState)
private static int unregisterTable (LuaCore.LuaState luaState)
{
var translator = ObjectTranslatorPool.Instance.Find (luaState);
return translator.unregisterTableInternal (luaState);
}
private int unregisterTableInternal (LuaCore.lua_State luaState)
private int unregisterTableInternal (LuaCore.LuaState luaState)
{
try {
if (LuaLib.lua_getmetatable (luaState, 1) != 0) {
......@@ -428,13 +428,13 @@ namespace NLua
[MonoTouch.MonoPInvokeCallback (typeof (LuaCore.lua_CFunction))]
#endif
[System.Runtime.InteropServices.AllowReversePInvokeCalls]
private static int getMethodSignature (LuaCore.lua_State luaState)
private static int getMethodSignature (LuaCore.LuaState luaState)
{
var translator = ObjectTranslatorPool.Instance.Find (luaState);
return translator.getMethodSignatureInternal (luaState);
}
private int getMethodSignatureInternal (LuaCore.lua_State luaState)
private int getMethodSignatureInternal (LuaCore.LuaState luaState)
{
IReflect klass;
object target;
......@@ -465,7 +465,7 @@ namespace NLua
//CP: Added ignore case
var method = klass.GetMethod (methodName, BindingFlags.Public | BindingFlags.Static |
BindingFlags.Instance | BindingFlags.FlattenHierarchy | BindingFlags.IgnoreCase, null, signature, null);
pushFunction (luaState, new LuaCore.lua_CFunction ((new LuaMethodWrapper (this, target, klass, method)).invokeFunction));
pushFunction (luaState, new LuaCore.LuaNativeFunction ((new LuaMethodWrapper (this, target, klass, method)).invokeFunction));
} catch (Exception e) {
throwError (luaState, e);
LuaLib.lua_pushnil (luaState);
......@@ -482,13 +482,13 @@ namespace NLua
[MonoTouch.MonoPInvokeCallback (typeof (LuaCore.lua_CFunction))]
#endif
[System.Runtime.InteropServices.AllowReversePInvokeCalls]
private static int getConstructorSignature (LuaCore.lua_State luaState)
private static int getConstructorSignature (LuaCore.LuaState luaState)
{
var translator = ObjectTranslatorPool.Instance.Find (luaState);
return translator.getConstructorSignatureInternal (luaState);
}
private int getConstructorSignatureInternal (LuaCore.lua_State luaState)
private int getConstructorSignatureInternal (LuaCore.LuaState luaState)
{
IReflect klass = null;
int udata = LuaLib.luanet_checkudata (luaState, 1, "luaNet_class");
......@@ -506,7 +506,7 @@ namespace NLua
try {
ConstructorInfo constructor = klass.UnderlyingSystemType.GetConstructor (signature);
pushFunction (luaState, new LuaCore.lua_CFunction ((new LuaMethodWrapper (this, null, klass, constructor)).invokeFunction));
pushFunction (luaState, new LuaCore.LuaNativeFunction ((new LuaMethodWrapper (this, null, klass, constructor)).invokeFunction));
} catch (Exception e) {
throwError (luaState, e);
LuaLib.lua_pushnil (luaState);
......@@ -518,7 +518,7 @@ namespace NLua
/*
* Pushes a type reference into the stack
*/
internal void pushType (LuaCore.lua_State luaState, Type t)
internal void pushType (LuaCore.LuaState luaState, Type t)
{
pushObject (luaState, new ProxyType (t), "luaNet_class");
}
......@@ -526,7 +526,7 @@ namespace NLua
/*
* Pushes a delegate into the stack
*/
internal void pushFunction (LuaCore.lua_State luaState, LuaCore.lua_CFunction func)
internal void pushFunction (LuaCore.LuaState luaState, LuaCore.LuaNativeFunction func)
{
pushObject (luaState, func, "luaNet_function");
}
......@@ -535,7 +535,7 @@ namespace NLua
* Pushes a CLR object into the Lua stack as an userdata
* with the provided metatable
*/
internal void pushObject (LuaCore.lua_State luaState, object o, string metatable)
internal void pushObject (LuaCore.LuaState luaState, object o, string metatable)
{
int index = -1;
......@@ -577,7 +577,7 @@ namespace NLua
* Pushes a new object into the Lua stack with the provided
* metatable
*/
private void pushNewObject (LuaCore.lua_State luaState, object o, int index, string metatable)
private void pushNewObject (LuaCore.LuaState luaState, object o, int index, string metatable)
{
if (metatable == "luaNet_metatable") {
// Gets or creates the metatable for the object's type
......@@ -625,7 +625,7 @@ namespace NLua
* Gets an object from the Lua stack with the desired type, if it matches, otherwise
* returns null.
*/
internal object getAsType (LuaCore.lua_State luaState, int stackPos, Type paramType)
internal object getAsType (LuaCore.LuaState luaState, int stackPos, Type paramType)
{
var extractor = typeChecker.checkType (luaState, stackPos, paramType);
return !extractor.IsNull () ? extractor (luaState, stackPos) : null;
......@@ -671,7 +671,7 @@ namespace NLua
/*
* Gets an object from the Lua stack according to its Lua type.
*/
internal object getObject (LuaCore.lua_State luaState, int index)
internal object getObject (LuaCore.LuaState luaState, int index)
{
var type = LuaLib.lua_type (luaState, index);
......@@ -709,7 +709,7 @@ namespace NLua
/*
* Gets the table in the index positon of the Lua stack.
*/
internal LuaTable getTable (LuaCore.lua_State luaState, int index)
internal LuaTable getTable (LuaCore.LuaState luaState, int index)
{
LuaLib.lua_pushvalue (luaState, index);
return new LuaTable (LuaLib.lua_ref (luaState, 1), interpreter);
......@@ -718,7 +718,7 @@ namespace NLua
/*
* Gets the userdata in the index positon of the Lua stack.
*/
internal LuaUserData getUserData (LuaCore.lua_State luaState, int index)
internal LuaUserData getUserData (LuaCore.LuaState luaState, int index)
{
LuaLib.lua_pushvalue (luaState, index);
return new LuaUserData (LuaLib.lua_ref (luaState, 1), interpreter);
......@@ -727,7 +727,7 @@ namespace NLua
/*
* Gets the function in the index positon of the Lua stack.
*/
internal LuaFunction getFunction (LuaCore.lua_State luaState, int index)
internal LuaFunction getFunction (LuaCore.LuaState luaState, int index)
{
LuaLib.lua_pushvalue (luaState, index);
return new LuaFunction (LuaLib.lua_ref (luaState, 1), interpreter);
......@@ -737,7 +737,7 @@ namespace NLua
* Gets the CLR object in the index positon of the Lua stack. Returns
* delegates as Lua functions.
*/
internal object getNetObject (LuaCore.lua_State luaState, int index)
internal object getNetObject (LuaCore.LuaState luaState, int index)
{
int idx = LuaLib.luanet_tonetobject (luaState, index);
return idx != -1 ? objects [idx] : null;
......@@ -747,7 +747,7 @@ namespace NLua
* Gets the CLR object in the index position of the Lua stack. Returns
* delegates as is.
*/
internal object getRawNetObject (LuaCore.lua_State luaState, int index)
internal object getRawNetObject (LuaCore.LuaState luaState, int index)
{
int udata = LuaLib.luanet_rawnetobj (luaState, index);
return udata != -1 ? objects [udata] : null;
......@@ -757,7 +757,7 @@ namespace NLua
* Pushes the entire array into the Lua stack and returns the number
* of elements pushed.
*/
internal int returnValues (LuaCore.lua_State luaState, object[] returnValues)
internal int returnValues (LuaCore.LuaState luaState, object[] returnValues)
{
if (LuaLib.lua_checkstack (luaState, returnValues.Length + 5)) {
for (int i = 0; i < returnValues.Length; i++)
......@@ -772,7 +772,7 @@ namespace NLua
* Gets the values from the provided index to
* the top of the stack and returns them in an array.
*/
internal object[] popValues (LuaCore.lua_State luaState, int oldTop)
internal object[] popValues (LuaCore.LuaState luaState, int oldTop)
{
int newTop = LuaLib.lua_gettop (luaState);
......@@ -793,7 +793,7 @@ namespace NLua
* the top of the stack and returns them in an array, casting
* them to the provided types.
*/
internal object[] popValues (LuaCore.lua_State luaState, int oldTop, Type[] popTypes)
internal object[] popValues (LuaCore.LuaState luaState, int oldTop, Type[] popTypes)
{
int newTop = LuaLib.lua_gettop (luaState);
......@@ -837,7 +837,7 @@ namespace NLua
/*
* Pushes the object into the Lua stack according to its type.
*/
internal void push (LuaCore.lua_State luaState, object o)
internal void push (LuaCore.LuaState luaState, object o)
{
if (o.IsNull ())
LuaLib.lua_pushnil (luaState);
......@@ -859,8 +859,8 @@ namespace NLua
(((ILuaGeneratedType)o).LuaInterfaceGetLuaTable ()).push (luaState);
else if (o is LuaTable)
((LuaTable)o).push (luaState);
else if (o is LuaCore.lua_CFunction)
pushFunction (luaState, (LuaCore.lua_CFunction)o);
else if (o is LuaCore.LuaNativeFunction)
pushFunction (luaState, (LuaCore.LuaNativeFunction)o);
else if (o is LuaFunction)
((LuaFunction)o).push (luaState);
else
......@@ -871,7 +871,7 @@ namespace NLua
* Checks if the method matches the arguments in the Lua stack, getting
* the arguments if it does.
*/
internal bool matchParameters (LuaCore.lua_State luaState, MethodBase method, ref MethodCache methodCache)
internal bool matchParameters (LuaCore.LuaState luaState, MethodBase method, ref MethodCache methodCache)
{
return metaFunctions.matchParameters (luaState, method, ref methodCache);
}
......
......@@ -36,7 +36,7 @@ namespace NLua
internal class ObjectTranslatorPool
{
private static volatile ObjectTranslatorPool instance = new ObjectTranslatorPool ();
private Dictionary<LuaCore.lua_State, ObjectTranslator> translators = new Dictionary<LuaCore.lua_State, ObjectTranslator>();
private Dictionary<LuaCore.LuaState, ObjectTranslator> translators = new Dictionary<LuaCore.LuaState, ObjectTranslator>();
public static ObjectTranslatorPool Instance
{
......@@ -50,12 +50,12 @@ namespace NLua
{
}
public void Add (LuaCore.lua_State luaState, ObjectTranslator translator)
public void Add (LuaCore.LuaState luaState, ObjectTranslator translator)
{
translators.Add(luaState , translator);
}
public ObjectTranslator Find (LuaCore.lua_State luaState)
public ObjectTranslator Find (LuaCore.LuaState luaState)
{
if (!translators.ContainsKey(luaState))
return null;
......@@ -63,7 +63,7 @@ namespace NLua
return translators [luaState];
}
public void Remove (LuaCore.lua_State luaState)
public void Remove (LuaCore.LuaState luaState)
{
if (!translators.ContainsKey (luaState))
return;
......
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