luaL_checkudata() private method

private luaL_checkudata ( IntPtr luaState, int ud, string tname ) : IntPtr
luaState System.IntPtr
ud int
tname string
return System.IntPtr
Esempio n. 1
0
        public static int GetIndex(IntPtr luaState)
        {
            var instancePointer = Lua.luaL_checkudata(luaState, 1, _typeFullName);
            var instanceIndex   = new IntPtr(Marshal.ReadInt32(instancePointer));

            return(instanceIndex.ToInt32());
        }
Esempio n. 2
0
        private static int DeleteInstance(IntPtr luaState)
        {
            var instancePointer = Lua.luaL_checkudata(luaState, 1, _typeFullName);
            var instanceIndex   = new IntPtr(Marshal.ReadInt32(instancePointer));

            _instancesDict[instanceIndex.ToInt32()] = default(T);
            _instancesDict.Remove(instanceIndex.ToInt32());
            return(0);
        }
Esempio n. 3
0
        public static T GetInstance(IntPtr luaState)
        {
            switch (_createPolicy)
            {
            case CreatePolicy.Factory:
                var instancePointer = Lua.luaL_checkudata(luaState, 1, _typeFullName);
                var instanceIndex   = new IntPtr(Marshal.ReadInt32(instancePointer));
                var instance        = _instancesDict[instanceIndex.ToInt32()];
                return(instance);

            case CreatePolicy.Singleton:
                return(_instance);

            default:
                return(default(T));
            }
        }