Esempio n. 1
0
        public static object ToVarTable(IntPtr L, int stackPos)
        {
            stackPos = LuaDLL.abs_index(L, stackPos);
            switch (LuaDLL.tolua_getvaluetype(L, stackPos))
            {
            case LuaValueType.Vector3:
                return(ToLua.ToVector3(L, stackPos));

            case LuaValueType.Quaternion:
                return(ToLua.ToQuaternion(L, stackPos));

            case LuaValueType.Vector2:
                return(ToLua.ToVector2(L, stackPos));

            case LuaValueType.Color:
                return(ToLua.ToColor(L, stackPos));

            case LuaValueType.Vector4:
                return(ToLua.ToVector4(L, stackPos));

            case LuaValueType.Ray:
                return(ToLua.ToRay(L, stackPos));

            case LuaValueType.Bounds:
                return(ToLua.ToBounds(L, stackPos));

            case LuaValueType.LayerMask:
                return(ToLua.ToLayerMask(L, stackPos));
            }
            LuaDLL.lua_pushvalue(L, stackPos);
            int reference = LuaDLL.toluaL_ref(L);

            return(LuaStatic.GetTable(L, reference));
        }
Esempio n. 2
0
        public static LuaThread ToLuaThread(IntPtr L, int stackPos)
        {
            stackPos = LuaDLL.abs_index(L, stackPos);
            LuaDLL.lua_pushvalue(L, stackPos);
            int reference = LuaDLL.toluaL_ref(L);

            return(LuaStatic.GetLuaThread(L, reference));
        }
Esempio n. 3
0
        public static LuaTable ToLuaTable(IntPtr L, int stackPos)
        {
            stackPos = LuaDLL.abs_index(L, stackPos);
            LuaState state = LuaState.Get(L);

            LuaDLL.lua_pushvalue(L, stackPos);
            int reference = LuaDLL.toluaL_ref(L);

            return(state.GetTable(reference));
        }
Esempio n. 4
0
 public static int luaL_callmeta(IntPtr L, int stackPos, string field)
 {
     stackPos = LuaDLL.abs_index(L, stackPos);
     if (LuaDLL.luaL_getmetafield(L, stackPos, field) == 0)
     {
         return(0);
     }
     LuaDLL.lua_pushvalue(L, stackPos);
     if (LuaDLL.lua_pcall(L, 1, 1, 0) != 0)
     {
         string msg = LuaDLL.lua_tostring(L, -1);
         LuaDLL.lua_pop(L, 1);
         throw new LuaException(msg, null, 1);
     }
     return(1);
 }