Ejemplo n.º 1
0
    static int GetComponent(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (count == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(GameObject), typeof(Type)))
        {
            GameObject arg0 = LuaScriptMgr.GetUnityObject <GameObject>(L, 1);
            Type       arg1 = LuaScriptMgr.GetTypeObject(L, 2);
            Component  o    = UtilCommon.GetComponent(arg0, arg1);
            LuaScriptMgr.Push(L, o);
            return(1);
        }
        else if (count == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(GameObject), typeof(string)))
        {
            GameObject arg0 = LuaScriptMgr.GetUnityObject <GameObject>(L, 1);
            string     arg1 = LuaScriptMgr.GetString(L, 2);
            Component  o    = UtilCommon.GetComponent(arg0, arg1);
            LuaScriptMgr.Push(L, o);
            return(1);
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: UtilCommon.GetComponent");
        }

        return(0);
    }